Installing the Analytics tag on a site that uses frames requires care to ensure that traffic is measured accurately, and that the referral information is retained.
In this article:Tag placement
A site using frames should include the tag 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 measure. If you place your tag within a <noframe>
tag thinking that this is equivalent to the body, the code will not run and no data will be recorded.
Missing Google Ads cost data (auto-tagging enabled)
The landing page URL of your ads is theframeset
parent HTML document, not the child frames within. If you haven't added tag to the <head>
section of your frameset
, Analytics won't record information from that page and your campaign parameters will be lost.
Missing referrals
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 tag 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 tag 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 install the tag on it. If a user reaches the page through a search engine or a direct link from another site and the page doesn't contain the tag, the referral, and/or campaign information from the source is lost. You may, however, choose to work with only some of the framed pages, or only the frameset itself. Your implementation will depend on what data you're interested in collecting.