开发者

Google Analytics UTMZ campaign is overwritten by direct?

开发者 https://www.devze.com 2023-03-01 05:19 出处:网络
i use Google Analytics with sub-domains and an iframe. The landing page on sub.mydomain.com contains an iframe with a registration form on www.mydomain.com.

i use Google Analytics with sub-domains and an iframe. The landing page on sub.mydomain.com contains an iframe with a registration form on www.mydomain.com.

  1. The user clicks a banner sub.mydomain.com/landing?utm_source=so1&utm_medium=dis&utm_campaign=xe1&utm_content=re1

  2. On the landing page, the registration form and the thankyou page this javascript code is used

    var pageTracker = _gat._getTracker("UA-xxxxxx");
    pageTracker._setDomainName(".mydomain.com");
    pageTracker._setAllowHash(false);
    pageTracker._setAllowLinker(true);
    pageTracker._trackPageview();
    

    on the landing page the iframe is loaded in the following way

    
    var iframe = document.getElementById('register_iframe');
    iframe.src = pageTracker._getLinkerUrl('http://www.mydomain.com/register.html');
    

  3. The cookies on sub.mydomain.com and the registration iframe from www.mydomain.com both contain _utmz with utmcsr=so1|utmccn=xe1|utmcmd=dis|utmcct=re1

  4. After submitting the the ajax form in the iframe the request for the thankyou page and some new javascript files still transfer the correct set __utmz cookie

  5. the javascript from 2. on the thank you page then requests the __utm.gif but is now transferring .utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) and the cookie on .mydomain.com is set to .utmcs开发者_Python百科r=(direct)|utmccn=(direct)|utmcmd=(none) too

As far as i know the ga code shouldn't overwrite a direct set source with direct or something else.

Thanks for any help


If Google Analytics Cross Domain Iframe Tracking is implemented as above, it should work.

I changed 2 things

  1. I forgot to set in the iframe tracker code pageTracker._setAllowLinker(true);

  2. I used on the landing page, that was hosted on a subdomain pageTracker._setDomainName("sub.mydomain.com"); i changed that to the same as on the main page in the iframe pageTracker._setDomainName(".mydomain.com");

As i understood the documentation that was not necessary, so don't know if that had an effect.

0

精彩评论

暂无评论...
验证码 换一张
取 消