Installing the Google Analytics tracking code on a site that uses frames requires care to ensure that traffic is tracked accurately, and that the referral information is retained.In this article:
Tracking code placementA site using frames should include the tracking code in the
<head>section of the
frameset(parent) page, as well as directly before the
</head>tag of each child frame that you want to track. If you place your tracking code within a
<noframe>tag thinking that this is equivalent to the body, the code will not run and no data will be recorded.
Missing AdWords cost data (auto-tagging enabled)The landing page URL of your ads is the
framesetparent HTML document, not the child frames within. If you haven't added tracking code to the
<head>section of your
frameset, Analytics won't track that page and your campaign parameters will be lost.
If all frames on the site reside on the same domain, then referral information can be properly recorded as long as you've installed the tracking code on the first page users see on the site.
If frames on the site reside on different domains, the referral information is likely to be inaccurate, since one frame may be recorded as the referring source of another. This is due to the hierarchical nature of frames, which gets recorded as a referring link.
In either case, the Navigation Summary and Site Overlay reports for sites with frames is not likely to provide useful information, since every frame with tracking code on it will be recorded as a separate pageview. Additionally, the order of these pageviews will depend on the order in which the frames are loaded, instead of the actual navigation path taken by your users.
Inflated number of pageviews
A web page that uses frames generates multiple pageviews: one for the framing page that contains either a
frameset or an
iframe tag within its HTML code), and one for each page displayed in a frame.
In your navigation reports, each of these pageviews appears in a sequence:
Framing page > framed page 1 > frame page 2
As a result, your pageview totals may be inflated.
Even if a page on your site only appears as a frame for another page, you should tag it with the tracking code. If a user reaches the page through a search engine or a direct link from another site and the page doesn't contain the tracking code, the referral, and/or campaign information from the source is lost. You may, however,choose to track only some of the framed pages, or only the frameset itself. Your implementation will depend on what data you're interested in collecting.