Set up (web)
Installing the Analytics tracking code on a site that uses frames requires some careful consideration to ensure that your traffic is tracked accurately, and that the referral information is retained.
- Where should I place my tracking code?
- Why isn't my CPC information appearing?
- Why aren't referrals showing up?
- Is my traffic being inflated?
<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.
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 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.
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 Audience > Behavior > Engagement report, as well as your pageview totals, may be somewhat inflated.
Even if a page on your site only appears as a frame for another page, we still recommend tagging 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.