Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Shopify Tracker

Littledata's tracking script for Shopify stores.

Shopify apps

This code is used by two Littledata apps:

Latest version

The latest minified versions of these scripts are hosted on a CDN:


These scripts rely on the LittledataLayer window-scope variable generated by a snippet in the Shopify store theme, and imported into the Store's active layout.


The following fields of the LittledataLayer object allow for configuration of tracking features:


To enable cross-domain tracking on pages that your Shopify store links to (destination domains) you can add an extra array of domains to the data layer. You do not need to add domains here which only send traffic to your Shopify store (source domains) - by default this script will look for the linker URL parameters.

You will also need to enable the Google Analytics linker on those source or destination domains.

Example: [''] (array)


Add the Google Ads (AdWords) conversion IDs that you configured with Ads. This accepts an array of strings. Our script will automatically add this to gtag('config') command.

Example: ['AW-11111111', 'AW-22222222'] (array)


This is where to add the Google Optimize container ID that you want to configure with gtag. Our script will automatically add this to gtag('config') command.

Example: GTM-123ABC (string)


This field to instructs the gtag library to mask the last 3 numbers of the user's IP address, to support greater user privacy at the expense of some geo-location accuracy.

Default: true (boolean)


This field opts your site into using Google Signals, to enable more powerful demographic reports and cross-device tracking using the Google Ads cookie. You need to check this is compatible with your website terms of use.

Default: true (boolean)


By default our tracking code briefly interrupts a click on a product in a product list, in order to send the tracking event before the page reloads. If this is interfering with other apps or scripts you can turn off product list click tracking.

Default: true


By default we track clicks on product images and social share buttons on the product details page. If this doesn't work with your theme you can opt out by setting this field to false.

Default: null


To enable tracking of users across a longer time period of Safari we store the cookie user ID in the browser local storage. Since there is no way to clear this local storage when the user deletes their cookies, you may need to check that this is consistent with your privacy policy.

Default: true (boolean)


Our app generates a branded message in the site console log. You can disable this.

Default: false (boolean)


For some themes, where the URL changes (e.g. a new variant) without a new page load our script will track a new page view. Change this setting to true to disable a new page view on history.replaceState() via browser History API

Default: undefined (boolean)

cookiesToTrack (Segment only)

Grab the values from an array of named cookies and pass them as traits on Segment identify calls.

Example: ['iterableEmailCampaignId] (array)


If you wish to direct the Measurement Protocol hits to a custom collection endpoint of your choosing, add it here. NOTE: this will block the sending of hits to Google Analytics.

Example: (string)

You can’t perform that action at this time.