Running Google Analytics in iframe?

橙三吉。 提交于 2019-12-02 23:32:02
Silver Dragon
  1. You have to append the Google Analytics tracking code to the end of example_page.html. The content between the <iframe> - </iframe> tag only displays for browsers, which do not support that specific tag.

  2. Should you need to merge the results from the subdomains, there's an excellent article on Google's help site: How do I track all of the subdomains for my site in one profile?

Sorry, but it's not going to work. The reason is because Google Analytics uses first-party cookies. This means the cookies that GA sets are specific to the domain the code is on. In your case, the iFrame is on a third-party domain. This means you're going to have two sets of GA cookies (one set for each domain), and no real way to reconcile the data.

Greg

In the specific case of iframes, Google doesn't say much. I've been in the same situation but I'm glad I figured it out. I posted a walkthrough here. It's in French but you won't need to speak the language to copy / paste the code. Plus there's a demo file you can download.

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