Trying to link http://www.example.com to my shopping cart on https://secure.example.com

Posted by Pickledegg on Stack Overflow See other posts from Stack Overflow or by Pickledegg
Published on 2010-03-24T17:24:21Z Indexed on 2010/03/25 1:53 UTC
Read the original article Hit count: 635

Filed under:
|

Heres my saga - I'm trying to link http://www.example.com to my shopping cart on https://secure.example.com, but it doesnt seem to be linking correctly.

Heres my code:

<!--Google Analytics -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-125xxxxx-1");
//start cart link
pageTracker._setDomainName(".example.com");
pageTracker._setAllowHash(false);
//end cart link
pageTracker._trackPageview();
} catch(err) {}</script>
<!--Google Analytics -->

Notice the two lines:

pageTracker._setDomainName(".example.com"); pageTracker._setAllowHash(false);

I added the first line so I could share the cookies between site and cart, and added the setAllowHash to make sure it used the utm values from the cookie, and didnt 'recreate' them when I entered https://secure.example.com.

Using firecookie, it does indeed share the same cookie between site and cart, and the cookies domain is 'example.com'.

I'm pretty sure though that if it was working right, all my utmz, utma values etc should be copied over and remain the same, but they're changing. I've copied all the params that are being sent to google analytics and pasted then below. It shows what is happening from my homepage, to my product page, then into my cart all the way to the page before ordering. ( I can't practically test the final page myself without buying something, so I'll post the code from our confirmation page later if needed.)

Here goes:

===============================================================
HOMEPAGE - http://www.example.com
----------------------------------------------------------------------------------------
utmac UA-125xxxxx-1
utmcc __utma=1.1920057171.1269446996.1269446996.1269446996.1;+__utmz=1.1269446996.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
utmcs UTF-8
utmdt GSM Cell Phone Rental from example
utmfl 10.0 r45
utmhid 69978133
utmhn www.example.com
utmje 1
utmn 1806413990
utmp /
utmr -
utmsc 24-bit
utmsr 1280x800
utmul en-gb
utmwv 4.6.5

PRODUCT PAGE - http://www.example.com/products/international-cell-phone-purchase/
----------------------------------------------------------------
utmac UA-125xxxxx-1
utmcc __utma=1.1920057171.1269446996.1269446996.1269446996.1;+__utmz=1.1269446996.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
utmcs UTF-8
utmdt example | International Cell Phones
utmfl 10.0 r45
utmhid 276151647
utmhn www.example.com
utmje 1
utmn 155808433
utmp /products/international-cell-phone-purchase/
utmr 0
utmsc 24-bit
utmsr 1280x800
utmul en-gb
utmwv 4.6.5

CART STAGE 1 - https://secure.example.com/checkout/viewbasket.php
------------------------------------------------
utmac UA-125xxxxx-1
utmcc __utma=60286578.994269564.1269447144.1269447144.1269447144.1;+__utmz=60286578.1269447144.1.1.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/products/international-cell-phone-purchase/;
utmcn 1
utmcs UTF-8
utmdt Your Cart
utmfl 10.0 r45
utmhid 1802074903
utmhn secure.example.com
utmje 1
utmn 1621444199
utmp 1-reviewcart
utmr http://www.example.com/products/international-cell-phone-purchase/
utmsc 24-bit
utmsr 1280x800
utmul en-gb
utmwv 4.6.5

CART STAGE 2 - https://secure.example.com/checkout/docheckout.php
------------------------------------------------
utmac UA-125xxxxx-1
utmcc __utma=60286578.994269564.1269447144.1269447144.1269447144.1;+__utmz=60286578.1269447144.1.1.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/products/international-cell-phone-purchase/;
utmcs UTF-8
utmdt Checkout
utmfl 10.0 r45
utmhid 871670520
utmhn secure.example.com
utmje 1
utmn 1153927228
utmp 2-checkout
utmr 0
utmsc 24-bit
utmsr 1280x800
utmul en-gb
utmwv 4.6.5

CART STAGE 3 - https://secure.example.com/checkout/doreview.php
----------------------------------------------
utmac UA-125xxxxx-1
utmcc __utma=60286578.994269564.1269447144.1269447144.1269447144.1;+__utmz=60286578.1269447144.1.1.utmcsr=example.com|utmccn=(referral)|utmcmd=referral|utmcct=/products/international-cell-phone-purchase/;
utmcs UTF-8
utmdt Checkout
utmfl 10.0 r45
utmhid 1731598159
utmhn secure.example.com
utmje 1
utmn 1442257710
utmp 3-checkoutreview
utmr 0
utmsc 24-bit
utmsr 1280x800
utmul en-gb
utmwv 4.6.5
===============================================================

As you can see, the utma values are not being preserved, so it looks like a config issue. I've studied the help does but none of the cases seem to fit mine.

I hope someone can offer help on this, its been an ongoing problem of mine for a while, and would be good to finally get rock-solid reliable analytics set up.

© Stack Overflow or respective owner

Related posts about google

Related posts about google-analytics