Set up (web)

Framed sites

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.

  1. Where should I place my tracking code?
  2. Why isn't my CPC information appearing?
  3. Why aren't referrals showing up?
  4. Is my traffic being inflated?

1. Where should I place my tracking code?

We recommend that a site using frames includes 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.

2. Why isn't my CPC information appearing even though I've enabled auto-tagging?

The landing page URL of your ads is the frameset parent HTML document, not the child frames within it. 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.

3. Why aren't referrals showing up?

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 visit 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 page view. Additionally, the order of these page views will depend on the order in which the frames are loaded instead of the actual navigation path taken by your visitors.

4. Is my traffic being inflated?

A web page that uses frames generates multiple page views: 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 page views appears in a sequence:

Framing page > framed page 1 > frame page 2

As a result, your Visitors > Behaviour > Engagement report, as well as your page view 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 visitor reaches the page through either a search engine or a direct link from another site, and the page doesn't contain the tracking code, then the referral and/or campaign information from the source is lost. However, you may choose to only track some of the framed pages, or only the frameset itself. Your implementation will depend on what data you're interested in collecting.