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.

Do you need to set up cross-domain tracking?

Google Analytics automatically tracks sessions across pages on the same subdomain. So traffic from blog.mystore.com to www.mystore.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.

Inbound links to your Shopify site

If you have landing pages that link to your Shopify site domain (e.g. www.myblog.com links to www.mystore.com) you need to ensure the Google Analytics tracker is adding the linker parameter to all cross-domain links.

Guides on how to do that are available for Universal Analytics (analytics.js), gtag and GTM.

Outbound links from your Shopify site

Our app has the following domains preset for cross-domain tracking for URLs that stores commonly direct traffic to:

  • 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 Littledata’s tracking script on the source Shopify site.

Littledata’s script supports an extraLinkerDomains property on the LittledataLayer where you can add extra domains 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: ["myblog.com"],
   persistentUserId: true,
   googleAdsConversionIds: ['AW-12345'],
   hideBranding: false,
   ecommerce: {
      currencyCode: '{{shop.currency}}',
      impressions: []
   }
};