@jclondon
Hey Jeff,
The process has a few components to it.
First, you’ll need to add the GTM tracking code to both your WordPress and Shopify sites. To add it within Shopify, you’ll need to place the embed code within the “Additional scripts” section of the Shopify checkout settings.
Second, you’ll need to edit the GTM embed code on both sites to include the “GA Linker plugin”. This is responsible for passing the tracking cookie from WordPress to Shopify. You can do this by setting the “domains” key inside your GA embed code.
Here’s an example of how it should roughly look on your WP site:
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="<https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXXX-X"/script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXXXXXXXX-X', {
'linker': {
'domains': ['yoursite.com', 'checkout.yoursite.com']
}
});
</script>
Notice this part specifically:
gtag('config', 'XXXXXXXXX-X', {
'linker': {
'domains': ['yoursite.com', 'checkout.yoursite.com']
}
});
You’ll want to change [‘yoursite.com’, ‘checkout.yoursite.com’] to match the possible domains you’ll be using on your Shopify checkout page.
Here, I’m using checkout.yoursite.com, but you may be using the standard myshopify.com domain.
Third, you’ll need to ensure all domains are included in the Referral Exclusion list as described here: https://developers.google.com/analytics/devguides/collection/analyticsjs/linker