I work for a company that has a large number of marketing sites, each of which pull in some info to an iFrame from another domain. I'm trying to track visitors through a given marketing site, to the page with the frame, and then through various pages in the frame. I have done quite a bit of reading on multi-domain tracking in GA, but can't seem to get it to recognize a visitor to a marketing site and the framed page as a single visitor.

On the marketing sites as well as on the pages within the frame, I use this GA code:

  _gaq.push(['_setAccount', 'UA-XXXXXXX-14']);
  _gaq.push(['_setDomainName', 'none']);
  _gaq.push(['_setAllowLinker', true]);

I load my iFrame with the following code:

_gaq.push(function() {
      var pageTracker = _gat._getTrackerByName();
      var iframe = document.getElementById('my_frame');
      iframe.src = pageTracker._getLinkerUrl('www.myurl.com');

Using GA Debug in Chrome, it appears that the GA parameters are being appended to the URL of the iframe correctly. Despite this, while viewing the "real-time overview", it shows a single visitor while I browse the marketing site until I get to the page with the frame, at which point it shows 2 unique visitors. This also breaks the "visitors flow" report, which shows a drop off at the page with the frame, instead of continuing to the new domain in the frame. Any suggestions or obvious problems?

1 Answer 1


You'll need to set the domain name of the parent page in this line of course:

_gaq.push(['_setDomainName', ' example-parent.com,']);

And this line should contain the URL to the iFrame content as specified here:

iframe.src = pageTracker._getLinkerUrl('http://www.my-example-iframecontent.com/');

This will pass the cookie information to the iFrame (note the privacy settings issue with IE 6+ covered there). However, this will still result in additional pageviews because each iFrame in itself is a page that gets loaded into the browser, so you'll need to create a custom filter to show them by separate domain as covered at the bottom of this.

  • I changed the domain name in the parent page, but I'm still getting 2 visitors when viewing the Real-Time Overview report. Maybe my assumption is incorrect, but shouldn't it continue to list just 1 returning visitor? I get 1 returning visitor until I hit the page with the frame, at which point I get 1 returning visitor (parent page) and 1 new visitor (framed page).
    – blowfish
    Oct 2, 2013 at 18:26
  • You're seeing what's expected - it's a new visitor to the iFrame content page on the other domain. You'll need to setup a filter to separate them as covered in my answer.
    – dan
    Oct 2, 2013 at 18:29

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.