I'm working on adding Google Analytics via Google Tag Manager. I'm adding the tracking code to an existing tag programmed using Iframes in almost every page of the site.

There are multiple frameworks under different subdomains. Sometimes there are two frameworks serving data for one page, both using Iframes.

Is there a way to track the page view of the parent window without incrementing the page count when it is inside an Iframe of the inner one? In that case I would just want event tracking?

  • You would either have to write some javascript on the innerframe not to run the "trackpageview" if your conditions are met, or better use something like querystrings on the iframes when the tracking is required and then use something like php, asp, to run the iframes.
    – Frank
    Commented Sep 22, 2014 at 12:35
  • Why wouldn't you just put the Analytics JavaScript snippet directly into the top level page? Commented Dec 2, 2014 at 21:10

1 Answer 1


You would need to add a javascript condition to see if the page is a parent page or a child page and only add the GA code if the page is a parent page. If the sub pages you are talking about are only accessed through the frames and never on their own then you just add the GA code to the parent page and not to the framed pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.