Has anyone implemented Google Optimize correctly?

Co_Lampwork_Jew
Shopify Partner
4 0 3

I subscribed to the beta testing of Google Optimize (optimize.google.com), and I was very curious to run the first test, but I couldn't manage to implement the snippets correctly.

Checking the source code, the GTM tag needed is shown correctly, but somehow it's not recognized by the Google Optimize app. I suspect that the way Shopify handles the Google Analytics snippet might have to do with this, but on the other hand I wonder: if I just paste the whole GA code in the <head> instead of using the option in the Settings, does that impact tracking at checkout?

Thanks!

Replies 13 (13)
viajeindia
New Member
1 0 1

Yes I have implemented google optimization correctly. Currently i optimized tour website and keyword is viajes a india you can follow.

http://viajeaindia.org/viajes-india-norte/
Co_Lampwork_Jew
Shopify Partner
4 0 3

Hi,

I'm not talking about SEO (are you talking about SEO?), but about Google Optimize, a new A/B testing platform by Google.

Thanks

eharri21
New Member
2 0 0

Were you able to get it?

I am at this point now as well and would like to get it working.

 

Thanks!!

Josh_Uebergang
Shopify Expert
853 30 214

Place the first line of code in the additional Google Analytics code in your online store preferences. The line will look like:

ga('require', 'GTM-XXXXXXX');

Paste the following in your theme.liquid file after the tag so that it loads before the analytics code. Replace GTM-XXXXXX with your code:

<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-XXXXXX':true});</script>

Follow the remaining steps as usual.

Run Google Shopping ads? Get the free definitive guide to Google Shopping for Shopify (no optin required): https://www.digitaldarts.com.au/google-shopping
mia_lexi
New Member
15 0 0

Very informative! One of the reasons i love this forum, i am constantly learning!

Edin
Shopify Partner
1 0 2

I've installed Google Optimize using Google Tag Manager and it worked flawlessly.

I am guessing that you have already done all the steps on the list, other than the adding the code to the page.

I have implemented the code for Optimize using Google Tag Manager built in tag for Optimize. All you need to do is:

1. Create a new tag in Google Tag Manager

2. Select Google Optimize tag from the list that pops up.

3. Insert Google Analytics Id and Optimize Id numbers in the fields.

4. Select all pages trigger

5. Create another new tag and select Custom HTML tag type

6. Copy hiding snippet from Google Optimize instructions Step 2

7. Change the number in the last line of code from the existing one to the ID number  of your Google Tag Manager account for the property where you are installing Optimize. This ensures that hiding snippet is as high as Tag Manager snippet.

Of course, this method is the only one that is available for those of you who have followed Google recommendation to install analytics snippet using Tag Manager. If that is the case you may have no other option to install Optimize. 

More detailed instructions (with pictures) are available in the blog post I wrote, Google Optimize: A First Look.

I hope this works for you.

Tricia_Treherne
New Member
2 0 0

I followed your instructions and got it to work, however I had two issues:

1. Could not get rid of the page flicker even after inserting the code.

2. Google Analytics stopped working. I have possibly got this working again.

Do you have any suggestions? Would love to get this working.

Thanks,

 

Tony_Bui
Shopify Expert
371 11 48

I've just checked your website and don't see Google Tag Manager code added. In the page source it's available, so I'm wondering how did you added it? I'm curious because working with GTM and Google Optimize. Both works fine for me now and have been doing testing with connection to Google Analytics via the tab "Experiments".

My integration Google Tag Manger and Google Optimize.

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

I stupidly forgot to start the experiment - Duh! which is why you didn't see it. I have started the experiment now.

I am getting the page flicker which I've decided to live with since I don't know to fix it - help!

I am not sure about the Analytics piece. It appears (according to tag manager) that analytics turns off for the variant page but stays on for the control page. I'll run for the day and see how things go.

Open to feedback.

Antony_Parker
Tourist
48 0 3

In addition to Google Optimize you can try with www.vwo.com or www.optimizely.com

 

Brad_Redding
Shopify Partner
13 0 3

After a few different combination tests between admin + GTM, I was able to replicate a process across multiple stores without seeing any page flickering (which can be pretty bad..a complete whitescreen for 1+sec). 

Step 1: Add the optimize snippet to the additional scripts config setting in admin
Step 2: Add page flickering via GTM

More implementation instructions on Optimize + Shopify here.

Let me know how it works!

See more analytics and marketing tips that we share based on our experience with Shopify - https://www.getelevar.com/resources/
Phil_J
Tourist
39 0 3

FYI including the GTM-xxx snippet in the Custom Javascript section in Shopify will now break Google Analytics if you have the new gTag snippet pasted in.

Harshal1
Tourist
6 0 3

After which tag do I implement the anti flicker snippet on theme.liquid. Also can this not be added in the Preferences section as an additional tag to GA tag.