Add allowLinker to Google Analytics Tracking Code?

New Member
1 0 1

I've got an Adwords campaign linked to a Google Analytics account and I'm trying to track ecommerce transactions as conversions from

Ad > > > transaction

I've had Google Analytics hooked up to Shopify via Online Store > Preferences > Google Analytics for some time now, and it's been sending correct data, but I need to add

{'allowLinker': true}

to the ga('create') function as per this article in order to attribute the source of the conversion to the ad instead of a referral from

I've already added

ga('require', 'linker');
ga('linker:autoLink', [''] );

to the Additional Google Analytics Javascript section, but changing the GA tracking code itself by adding allowLinker to the ga('create') function doesn't seem to change anything on the website (it also doesn't change conversion tracking test results).

The GA part of the .analytics script (the only place I could find my analytics tracking code on my Shopify site, so I assume that's what changes when I enter the tracking code in Preferences > Google Analytics) doesn't change from

Google Analytics":{"trackingId":"UA-XXXXXXX-Y","domain":"auto","siteSpeedSampleRate":"10","enhancedEcommerce":true,"doubleClick":true,"includeSearch":true}

in any way when I add the allowLinker property to the "Paste your code from Google here" section, which leads me to believe that Shopify only grabs a few properties from the GA tracking code (e.g., the tracking ID) and ditches the rest (e.g., the allowLinker property I added).

The reasons that this is a problem are

1. I can't just add the

  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

to the "Paste your code from Google here" section so as to add the ga('create') function with the allowLinker property to the Additional Google Analytics Javascript section because Shopify throws a "Analytics snippet does not look valid (UA-xxxx-x)" error if I try that.

2. If I add the same tracker to the Additional Google Analytics Javascript section with the allowLinker property like so

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});

then I think I'd be double-counting my pageviews because there'd be two trackers with the same tracking ID (one in the default Google Analytics code section and one in the Additional Google Analytics Javascript section).

3. I could link the default Google Analytics code section to a different Analytics account and just enter the trackers I actually want into the Additional Google Analytics Javascript section (or even the theme.liquid file) with the allowLinker property, but ecommerce transaction data wouldn't be sent through those trackers, only pageviews.

So the question is how do I add the allowLinker property to the default Google Analytics code (the "Paste your code from Google here") section? I can't think of anything else to try.

Replies 2 (2)
Shopify Expert
938 39 242

Hi Lexey,

If you run the GA debugger in Chrome, you'll see Shopify sends the allowLinker and sets it to auto. That is not something you need to worry about. If sales are not being attributed at all to AdWords, then you need to autolink AdWords with Analytics and make sure everything else is setup right, mainly the referral exclusion list. See my complete Shopify analytics guide on how to set it up.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required):
Shopify Expert
371 11 48

My suggestion based on experience is use Google Tag Manager implementation and it's simply configured with just 01 option.


❤️ Found my answer helpful? Please LIKE or Accept Solutions.
❤️Top 30 Best Shopify Themes Free + Premium: A Complete Review Read More