Mobile app version of vmapp.org
Login or Join
Kristi941

: How to track iframe and parent window as one pageview in Google Analytics I have a site that contains the following characteristics: Header is defined by code my team controls on subdomain

@Kristi941

Posted in: #GoogleAnalytics

I have a site that contains the following characteristics:


Header is defined by code my team controls on subdomain B and is loaded via iframe
Body is defined by third-party code and platform on subdomain A and is the parent page
Footer is defined by code my team controls on subdomain B and is loaded via iframe


I am using Google Analytics (GA) to track pageviews. I would like the load of each page (consisting of all three elements) to register in GA as one pageview. In addition, clicks in the header and footer should not count as referred visits. How can I accomplish this?

I know that I can solve the referrer issue with cross-domain tracking:

['_setDomainName', 'maindomain.com']


However, I also have to track the pageview to make it take effect:

['_trackPageview']


This would result in 3 pageviews tracked for one actual page load as far as the user is concerned. Since this particular site nets millions of visitors a month, tripling that is not ideal and would put us over the 10 million events Google Analytics will track reliably on the free plan.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Kristi941

2 Comments

Sorted by latest first Latest Oldest Best

 

@Radia820

I'd honestly have to question the complexity of the setup you're proposing, it won't help the usability of the site overall and you'd be downloading the script three times for no good reason. Include files were developed for precisely this reason and would strongly advise you to reconsider your plan.

Secondly you're bumping into the dividing line between GA and paid for solutions like webtrends or omniture which offer more scriptable tags. For a site of this size you really need to move into the paid for analytics field to help you make sense of this complexity. However this answer over at SO 'IFrame Subdomain tracking with Google Analytics' may offer a solution.

Otherwise I think you might be able to push some custom events for each tag which would allow you to manually add up the numbers and get a result, but GA simply wasn't built to cope with scenarios like this.

10% popularity Vote Up Vote Down


 

@Lengel546

I'm not sure this is possible with the current version of Google Analytics and is perhaps a suggestion you need to make to them.

However, if you're happy for only the main page (that includes the iFrame code) to be tracked, you could put the Google Analytics code on that page and not on your subdomain pages. This would mean any clicks inside the iframes would not be tracked which is probably not what you want. This would probably be better than your current situation though.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme