HOW TO GUIDE: Track Referrer URL with Google Analytics / Tag Manager via Shopify Lite Buy Button

Tourist
4 0 2
2 Likes
Highlighted
New Member
2 0 0

If been following this topic, Google Analytics Tracking with Shopify Buy Button for a long time and surprised that there really isn't any official support. Anyway this post is helpful! I also wanted to share that with some of our own torubleshooting and trying to get FB tracking pixels to work you can actually "embed" the Shopify Buy Button as part of the DOM and not rely on the iframe injection.

 

https://shopify.github.io/buy-button-js/advanced/

 

There are a few things...

 

You can add DOM events (if you continue to use the iframe injection)

 

var product = {
  DOMEvents: {
    'click .button': function (event) {
      myAnalyticsLibrary.track()
    }
  }
}

or if you declare that you don't want to use the iframe at that point the markup is part of the DOM and you could add any type of custom event via GA or GTM.

 

var options = {
  product: {
    iframe: false
  },
  cart: {
    iframe: false
  }
}

Hope this helps or sparks a new idea.

0 Likes