This is a guide to how Littledata’s CartHook connection works with your Google Analytics setup. We look at the underlying problem this connection solves from a bird’s eye view, followed by a deep dive into how things work behind the scenes.


The marketing attribution of orders through CartHook frequently goes wrong with CartHook’s basic Google Analytics integration. The primary reason why that happens is when customers are referred to the CartHook checkout the original source of the customer is often lost.

Littledata has worked with CartHook to solve this problem by maintaining a unique Google Client ID for each customer through the whole journey from product viewed to checkout. The Google Client ID is then ultimately passed on to Google Analytics, where you can view and analyze a unified customer journey along with accurate attribution to the marketing source.

What happens behind the scenes?

Littledata makes a server-side integration between Shopify and Google Analytics. Every time an order is processed on Shopify we link that revenue to the customer session on Google Analytics.

To link those two we add a script to the checkout pages to link the GA Client ID and CartHook checkout ID with the Shopify order for correct attribution. Upon authorizing Littledata with CartHook, we insert a tracking script within CartHook’s checkout pages which does the following:

  • Loads gtag.js with the customer’s reporting Google Analytics property ID;
  • Ensures cross-domain tracking between storefront and checkout;
  • Communicates to Littledata’s servers the GA Client ID and CartHook sessions ID;
  • Tracks events on the checkout and upsell pages.

Google Analytics events

Our script triggers the following events on CartHook’s pages.

Checkout steps

GA category: CartHook (Littledata)

GA action: Checkout

These events are consistent with the Shopify checkout funnel, and are triggered on:

  • Step 1 (Contact information): landing on CartHook checkout page
  • Step 2 (Shipping information): after completing email field
  • Step 3 (Payment method): after completing ZIP/postal field

Landing on upsell (or downsell) page

GA category: CartHook (Littledata)

GA action: View upsell offer

GA label: product name

GTM trigger: transactionBeforeUpsell

GTM variables: orderId, value, items, tax, subtotal, shipping

Accepting upsell offer

GA category: CartHook (Littledata)

GA action: Accept offer

GA label: product name

Rejecting upsell offer

GA category: CartHook (Littledata)

GA action: Reject offer

GA label: product name

Learn more

You can install the CartHook connection directly in the Littledata app, or from your CartHook admin.