Is Google Analytics tracking code blocked from Buy Now buttons?

Highlighted
New Member
6 0 0

I have been trying to add Google Analytics event tracking code to my Shopify Buy Now button.

It's the same format of tracking code that I've used elsewhere on links on the same page (so I know it works in theory). However, when used in the Shopify script, it's not being picked up by Google Analytics. Have Shopify blocked this on purpose?

I've put my embed code below (with some numbers removed for privacy) with the tacking code included in the link.

 

<div data-embed_type="product" data-shop="arabic-reading-course.myshopify.com" data-product_name="Lessons 7 to 13" data-product_handle="lessons-7-to-13" data-has_image="false" data-display_size="compact" data-redirect_to="checkout" data-buy_button_text="Buy now" data-buy_button_out_of_stock_text="Out of Stock" data-buy_button_product_unavailable_text="Unavailable" data-button_background_color="7db461" data-button_text_color="ffffff" data-product_modal="false" data-product_title_color="000000" data-next_page_button_text="Next page"></div> <script type="text/javascript"> document.getElementById('ShopifyEmbedScript') || document.write('<script type="text/javascript" src="https://widgets.shopifyapps.com/assets/widgets/embed/client.js" id="ShopifyEmbedScript"><\/script>'); </script> <noscript><a href="https://arabic-reading-course.myshopify.com/cart/xxxxxxxx:1" target="_blank" onClick="_gaq.push(['_trackEvent', 'Buy Button', 'Click', 'Buy Page']);">Buy Lessons 7 to 13</a></noscript>

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
224 1 25

Hey there!

Patrick, a Shopify Guru here :). 

What your looking for should be possible but it would require some changes to your current tracking codes. Google has a guide here that goes through some of the changes you'll need to make to track the interactions across the different domains.

Hope that helps :)
Patrick
support@shopify.com

0 Likes
Highlighted
New Member
6 0 0

Thanks Patrick!

0 Likes
Highlighted
New Member
6 0 0

I've now implemented the correct code from Google but it's still not tracking clicks on the button from Shopify's embed code. (Other outbound text links on the same page are tracked).

I can't be the only person who wants to track clicks on my buy now button. How have others managed to make this work?

0 Likes

Hi Sarah,

If you disable javascript in your browser, the link tracking will probably work but you have no event tracking for javascript. To track Buy Buttons, I recommend you use Google Tag Manager. That way you can configure it once and have tracking for all buy buttons without altering them at all.

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