Tracking custom IFRAME events in Google Tag Manager

和自甴很熟 提交于 2019-12-01 06:26:43

问题


I have some IFRAMEs on my pages for external services -- AddThis, YouTube, and a JWPlayer-based custom video solution. I want to use GTM to track clicks and responses in those IFRAMEs (particularly 'play' events on the video) but the cross-domain policy prevents that. How do I make that work -- and how do I get it to work in GTM?


回答1:


It took me a while to figure it out, but basically:

  • Create a GTM container and add the GTM codeblock to pages on your site.
  • Create a ‘Tag’ to be your event listener.
  • Create two ‘Triggers’: one for which pages to listen for the event, and one that fires when your event happens.
  • Create one or more ‘Variables’ to store the info from your event listener ‘Tag’
  • Create another ‘Tag’ to take the info you stored in the ‘Variables’ and pass it to Google Analytics.
  • Go into the Google Analytics console and watch the events come in.

I wrote up a more complete, long-form guide at http://ieg.wnet.org/blog/using-google-tag-manager-for-custom-event-tracking/



来源:https://stackoverflow.com/questions/31343545/tracking-custom-iframe-events-in-google-tag-manager

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!