简体   繁体   中英

Cross-Domain iFrame Tracking with Google Analytics

I have a site (rails 3.2) that displays 3rd party news articles within an iframe. One page contains one iframe. I have Google Analytics setup. For this I use segment.io. The tracking script is in the head section of the container page.

We have no affiliation with the 3rd party news sites. I wanted to check that these 3rd party sites still receive all their analytics data to their own analytics platforms, as if the page was viewed properly in a browser and not in an iframe. So one view for my site and one view for the 3rd party site. Is this correct?

I have seen lots of questions which seem to refer to both parent and iframe site having the same owner. So I wanted to ask a more specific question. Forgive me if this has been answered before.

The iframe is not at all affected by the tracking in your container page. To affect the tracking in the iframe you would need to implement code in the 3rd party site which you apparently do not do.

This isn't even specific to Google Analytics, there are all kinds of safeguards in the browser that prevent the javascript in the container from affecting the framed site (for completeness sake, of course you can still pass url parameters, so if the framed site is badly programmed cross-site scripting is possible - but that's a different thing than accessing the framed page with javascript).

So you do not need to do anything special, Analytics not interfering with their tracking is the default thing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM