If you use Littledata’s Shopify app for Google Analytics to fix your analytics tracking, then the cross-domain tracking is configured out of the box. However, you may need to implement an extra setting if your Shopify store is directing traffic to a different domain to Shopify store.

Do you need to set up cross-domain tracking?

Google Analytics automatically tracks sessions across pages on the same subdomain. So traffic from blog.mydomain.com to www.mydomain.com will be tracked OK without modifications.

The problem comes if you have traffic from another domain like www.myblog.com, and Google cannot set a user cookie which can be read across both domains. In this case our script needs to read the cookie identifier from a URL parameter that the GA tracking script adds. You can read more here.

Preset cross-domain tracking for Littledata users

Our app has the following domains preset for cross-domain tracking:

  • myshopify.com
  • shopify.com (including cdn.shopify.com)
  • rechargeapps.com
  • recurringcheckout.com
  • carthook.com
  • checkout.com

How to set up additional cross-domain tracking

If you have pages running on domains that are NOT in that preset list you will need to update your tracking script on the source domain and potentially update Littledata’s tracking script on the destination Shopify site.

1. Update GA tracking on the source domain

You need to enable cross-domain tracking on the source domain that is linking to your Shopify main domain. Guides on how to do that are available for Universal Analytics (analytics.js), gtag and GTM.

2. Update Littledata’s script

Littledata’s script supports an extraLinkerDomains property on the LittledataLayer where you can add extra sites for cross-domain linking. You only need to edit this if your Shopify store is sending traffic to the destination domain. Any traffic from source domains is automatically linked.

You can read our script documentation here.

To set up extra destination domains you or your developer will need to manually edit Littledata’ tracking snippet.

Go to your Shopify Admin >> Online Store >> Themes >> Actions >> Edit Code >> Search for LittledataLayer.liquid; you can add the extraLinkerDomains property to the LittledataLayer object as follows:

					

LittledataLayer = {
   transactionWatcherURL: 'https://transactions.littledata.io',
   referralExclusion: /(paypal|visa|MasterCard|clicksafe|arcot\.com|geschuetzteinkaufen|checkout\.shopify\.com|checkout\.rechargeapps\.com|portal\.afterpay\.com|payfort)/,
   googleSignals: true,
   anonymizeIp: true,
   productClicks: true,
   extraLinkerDomains: ["domain1.com", "domain2.com"],
   persistentUserId: true,
   googleAdsConversionIds: ['AW-12345'],
   hideBranding: false,
   ecommerce: {
      currencyCode: '{{shop.currency}}',
      impressions: []
   }
};