Optimize
4.8K members online now
4.8K members online now
Everything you need to know about setting up Optimize including creating your account and container, linking to Google Analytics and how to tag your site.
Guide Me
star_border
Reply

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

OPTIMIZE with SHOPIFY?

 

I wanted to gather some feedback on using it within the back end of a Shopify account and had some issues implementing the setup.

 

Anyone have experience with this working successfully? 

 

 

Loving the collaboration that goes on in here. Truly a place for people to learn, teach, and grow together. Cat Very Happy

 

Thanks everyone for the warm welcomes thus far.

 

Roland John Poulin

Founder & Creative Director

Aftermarket Digital

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Roland AD
April 2017

Google Optimize for Shopify

Follower ✭ ☆ ☆
# 4
Follower ✭ ☆ ☆

You'll need to implement the GA snippet directly in the theme, rather than using the automatic installer provided via the Shopify dashboard. Remove the GA account number from Online store > Preferences > Google Analytics, and add the snippet provided by GA somewhere in the <head> tag.

 

We plan to use this for product page optimization experiments, so we'll have a conditional Liquid wrapper like:
{%- if template contains 'product' -%}ga('require', 'GTM-XXXXXXX');{%- endif -%}

View solution in original post

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 2
Visitor ✭ ✭ ✭

I'm also having a challenging time getting it set up. I added the Google Optimize specific line of code in the "Additional Google Analytics Javascript" section of Preferences and plugged in the hiding code in the HTML editor, but I'm not seeing any data being pulled in to the dummy test I created in Google Optimize.

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

I got it working by adding the optimize tag in the "additional scripts" area in Shopify, then adding the Optimize script to my theme.liquid file above the </head> tag.  

 

However, I removed it since it seems like the entire page loads in the background and once that's done it all displays at once, as opposed to loading progressively, which made the experience really slow IMHO.  

 

Sure cool feature, but unless you have a lightning fast page, or somehow implement it only on "product pages" or some other more limited solution via the product.liquid (or similar) file, it seems a bit to bulky for shopify deployment. 

 

Maybe someone else has a different solution?

Marked as Best Answer.
Solution
Accepted by topic author Roland AD
April 2017

Google Optimize for Shopify

Follower ✭ ☆ ☆
# 4
Follower ✭ ☆ ☆

You'll need to implement the GA snippet directly in the theme, rather than using the automatic installer provided via the Shopify dashboard. Remove the GA account number from Online store > Preferences > Google Analytics, and add the snippet provided by GA somewhere in the <head> tag.

 

We plan to use this for product page optimization experiments, so we'll have a conditional Liquid wrapper like:
{%- if template contains 'product' -%}ga('require', 'GTM-XXXXXXX');{%- endif -%}

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

This definitely looks like the best solution to me.  Thanks for sharing this.

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 6
Visitor ✭ ✭ ✭

Update with some lessons learned, feedback welcome: https://atlasco.io/blogs/news/how-to-install-google-optimize-in-shopify

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

Hello

 

Is it possible to implement it also with Google tag manager? 

 

Thanks

Re: Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 8
Visitor ✭ ✭ ✭
Yes, just make sure you put the code in the theme.liquid file and then use
GTM to mass tag the site. Then you should be set.

Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

I'll dig into this and get back to you. Great initiative @Cameron S. Smiley Happy

Re: Google Optimize for Shopify

Visitor ✭ ✭ ✭
# 10
Visitor ✭ ✭ ✭

Hi there,

This is a problem with blogger and GTM - blogger parses everything as XML which causes problems with the GTM
tag.
Try the following:
In the code of your container tag you should see this line

j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=

 


replace that line with this line - the change is

j=d.createElement(s),dl=l!='dataLayer'?'&amp;l='+l:'';j.async=true;j.src=

 

Then copy the adjusted code in your blogger template and save the template - it should work now. When you then check the
source code of the website you can see that the '&amp;' has been changed back by blogger to the correct '&', so the code
that is actually included on the website is exactly the code that GTM requires.

Good luck

Claudia