The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Google Analytics not tracking between subdomains

mreeemreee Member
in Help edited July 2013
I've followed the instructions for setting up Google Analytics with my shop. It was very straightforward and I've double checked the installation twice. After looking at my profile I set up for testing though, I had an unusually high bounce rate. When looking deeper it was showing my primary domain, http://1hourbreak.com, was a source for my subdomain, secure.1hourbreak.com, where I have my checkout. So it isn't keeping the session open for my visitors between my subdomain.

Any ideas to why this could be happening?
Comments
  • fc_adamfc_adam FoxyCart Team
    @mreee,

    Are you working on your page currently? When I first started testing clicking an add to cart link was forwarding me straight to the checkout, but just now it's started loading the cart in a modal window.

    If the straight to checkout was how it was, I believe the issue you were running into was the Google Analytics code wasn't being added into the cart session to ensure it was carried across... actually - as you're using a custom subdomain, it should track across fine. I think the issue is you need to set the 'setDomainName' to be the same across the board, so converting this:
    _gaq.push(['_setDomainName', 'none']);
    

    to this:
    _gaq.push(['_setDomainName', '.1hourbreak.com']);
    


    Otherwise, if you switch the process.add_pre function to look like this, that should help as well:
    fcc.events.cart.process.add_pre(function(e, arr) {
    	var pageTracker = _gat._getTrackerByName();
    	jQuery.getJSON('https://' + storedomain + '/cart?' + fcc.session_get() + '&h:ga=' + escape(pageTracker._getLinkerUrl('', true)) + '&output=json&callback=?', function(data){
    		FC.json = data;
    		fcc.events.cart.process.resume();
    	});
    	return "pause";
    });
    
  • mreeemreee Member
    @fc_adam

    We have been making some changes to our checkout process. The process is now set to send people to the cart(different page) and then to the checkout.

    Sorry for the confusion.

    Do I still need to add the last block of code to make it work?
  • fc_adamfc_adam FoxyCart Team
    @mreee,

    If you're sending people to the cart as a new page rather than in a modal, I'd suggest testing that first change I mentioned - if that doesn't work, applying the second one should get it working.

    For testing if it's working, take a look at the 'realtime' section of the Google Analytics administration, and watch the content page as you navigate between pages. You should see the correct single session changing it's url between your site and the cart and checkout.
  • brettbrett FoxyCart Team
    Fwiw, we're pretty fanatic about how awesome http://Segment.io/ is. Getting any solid analytics in place is decidedly _not_ easy to do, but their abstraction makes it a LOT easier, and if you add their code it'll be _super_ easy to then add drip email campaigns and stuff like Mixpanel or KISSmetrics (one of which you _definitely_ should add).
Sign In or Register to comment.