Tracking custom IFRAME events in Google Tag Manager
I have some IFRAMEs in my pages for external services - AddThis, YouTube and a custom video solution based on JWPlayer. I want to use GTM to track clicks and responses in these IFRAMEs (specifically, "playing" events on the video), but the cross-domain policy prevents this. How can I make this work - and how do I get it to work in GTM?
+3
source to share
1 answer
It took me a while to figure it out, but basically:
- Create a GTM container and add the GTM codeblock to your website pages.
- Create a tag to be your event listener.
- Create two triggers: one for which the pages listen for an event, and one that fires when your event occurs.
- Create one or more variables to store information from your event listener
- Create another tag to get the information you saved in Variables and feed it to Google Analytics.
- Go to the Google Analytics console and see how the events are going.
I wrote a more complete, long tutorial on http://ieg.wnet.org/blog/using-google-tag-manager-for-custom-event-tracking/
+2
source to share