Follow
       
Stay informed

Thanks. We've added you to our list.

Blog

Abobe Business Catalyst Parter specialising in Web Development and BC integration.

Go Back

Business Catalyst vs Google Analytics Cross Domain Tracking

by Gary Swanepoel


Sep 04, 2012 Comments (3) share

Sharing data across Business Catalyst's *.worldsecuresystem.com domain for Google Analytics doesn't have to be painful. Here's the way we do it to make sure you can provide an ROI for your marketing strategy against purchases made on the site. 

Not all partners might be aware but once you get to the secure area of your site (ie. land on https://yourwebsite.worldsecuresystems.com) you loose all the information gathered from Google about your customer's originating source such as organic searches, Adword Pay Per Click, email campaigns, website and social referrals, etc. Which are vital if you are going to track a conversion on a secure page and measure which marketing channels are profitable, in actual dollar figures.

What should I be getting?

If you log into Analtyics and head to Traffic Sources > Referrals how many time haves you seen your website as a top referral? In fact, how many times have your seen your website the top referral source for goal conversions or other measurements with a Business Catalyst website?

That's because once you move to from www.website.com to website.worldsecuresystems.com you haven't told Google it's the same site. As far as the Google's tracker is aware you've moved to a completely different website since the cookies are based around the root domain name, not the GA ID.

Unless that's how you intended to set it up,having your BC website as a referral is wrong.

So what do I do?

We've all read Google's documengobbledygook on Cross-Domain Tracking but in a nutshell we just want to tell google that your BC website and the World Secure site are the same thing.

In this example we going to look at passing your analytics data through the shopping cart and onto the receipt page. Where you've hopefully setup your conversion ...

<script type="text/javascript">
     var _gaq = _gaq || [];
     _gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
     _gaq.push(['_setDomainName', 'none']);
     _gaq.push(['_setAllowLinker', true]);
     _gaq.push(['_trackPageview']);
     (function() {
          var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
          ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
          var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
     })();
</script>

What are the key things here?

     _gaq.push(['_setDomainName', 'none']);
     _gaq.push(['_setAllowLinker', true]);

Now, a lot of references will use _gaq.push(['_setDomainName', '.website.com']); but it actually makes things a lot more confusing because we now have to deal with sub-domains and you know what? I don't really need to know it. It's all the one system. I can use this on all my sites without having to worry about how the site is setup and whether redirects are in place and so on.

Setting the domain name to _none basically tells google "Look, I've got the same Google ID on both domains, that should be enough to tell you that they're the same site?".

If you want to track a customer moving between the two domains, then this won't work for you.

There will be situations where you'll need to specify the root domain, but unless you know what you're doing, keep it simple.

If you want to understand exactly how this works, read Google's documentation. It lays it all out quite clearly. Otherwise hit some blog posts that will dumb it down a little until it all makes sense.

Ok, it's in .. now what?

Now, all the data's being stored under the one account we need to pass the cookie along to the new domain. Again, I'm not going to go into details about Same Original Policies and cross-browser domain restrictions. There a bunch of blogs out there that you can read about this on.

On the Shopping Cart Page

Log into BC and navigate to Site Manager > Module Templates > Online Shop Layouts > Shopping Cart

Place the following script at the bottom of the page(must already have jQuery 1.7+ on the page or template).

jQuery('#catshopbuy').prop('onclick', null);
jQuery('body').on('click','#catshopbuy',function(e){
	e.preventDefault();
	if (ValidateCart({module_oid})) _gaq.push(['_link', this.href]);
});
jQuery('body').on('click','#catshopquote',function(){
	_gaq.push(['_link', this.href]);
});

You can use _gaq.push(['_link', obj.href]) for all links that point to *.worldsecuresystems.com but at least this will get your data over to the shopping cart. You also need to handle forms a little differently, but we're not going to cover that in this post.

This will override BC's inline script and also address IE's inability to handle modifications to the onclick="" element. Don't expect this to work in < IE7.

What about the other pages?

We use a more robust script for our more complicated sites. Get in contact with us and we'll give you a hand in setting it up.

Ok .. now what should I see.

When you log into analytics go to Content > Site Content > All Pages and run a search for the receipt page. Depending on how you've set it up in most cases it will be /WebFormID=XXXX. The ID referring to the Payment Form you are using. Whether default or custom.

Change the Secondary Dimension to Source.

If you've done it all right (and once you've got a few orders come through) you should no longer see the referral source as website.com. What you should start seeing now is things like google, email campaign names, facebook campaigns. If you change the secondary dimension to Medium you get an even better idea as to whether it's CPC or another defined medium.

Just recap for me?

We've now passed Google Analytics tracking from your website to the receipt page on the World Secure System's domain. Which means you can tell your customer exactly where their purchases came from, whether Adwords, an email or Facebook campaign or just from plain good old organic searches. It's a great way to prove to your customers that all your hard work is paying off and if you've setup your Google Analytics account correctly you'll be able to tell your customers how much money they generated from these sources.

What a great way to demonstrate the success of a website.


3 Comments so far

fromColin 07-Nov-2012 01:57 PM

this is AWESOME!

fromBRad 19-Nov-2012 12:12 PM

You're a legend!

fromGreg Tomkins 28-Sep-2013 07:32 AM

Thanks Gary for providing the answer to an issue I have pondered over for ages
Back to Top
Post your own comment


Captcha Image