Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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]);
  _gaq.push(['_trackPageview']);

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?

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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 '13 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 '13 at 18:29
    
I did set up a filter and I do see the different domains. Should the "Visitors Flow" report track a user from the parent page through the framed pages? If not, is there a way to track a user from the parent page to a goal URL that's within the frame? Thanks for the help. I'm new to GA. –  blowfish Oct 2 '13 at 18:46
    
It takes time for data to show up in other reports versus Real-Time. I'll have a look at the question later if you decide to post it (and someone else doesn't answer it first). –  dan Oct 2 '13 at 19:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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