Integration and Testing

Authorize.Net API questions and help with your payment integration.

Posts: 1
Registered: ‎09-12-2012

Google Analytics E-commerce Integration Problems

We are trying to integrate the Google Analytics Ecommerce but are having problems keeping the attribution going from the website to the payment gateway
We have tried a few things but athough we can track revenue on the final page after credit card payment. We lose the cookies for Google Analytics when they cross the domain in the meantime, so this means we cant see which marketing channel the visitor transacts from
Are there any solutions for this?

Posts: 4,525
Registered: ‎03-08-2010

Re: Google Analytics E-commerce Integration Problems

Posts: 1
Registered: ‎03-05-2013

Re: Google Analytics E-commerce Integration Problems

I have been frustrated by this exact issue for over the past few weeks.


I was able to get the ecommerce setup by including the appropriate GA code in the relay-response URL, but like peterloleit, all attribution of the sales was going to my main domain, instead of giving proper campaign attribution.


I tried it ALL using variations of _setDomainName _setAllowLinker _linkByPost, but NOTHING would pass cookies to properly.


Finally, I found a workaround that will let me attribute my campaigns!


1) For the pages on my domain, I added in the following GA code...


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

2) On my relay-response page, which ultimately shows on, I included...

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

3) I found the following JS that'll let you read cookies, so I used it as an include for the pages on MY domain:

<script type="text/javascript" src="js/gaCookies.js"></script> 

4) Then, I appened the cookie params to the end of the order form's action URL.

<!-- Get campaign cookies to pass to Authorize domain -->
<script type="text/javascript">
var gac = new gaCookies();
var gaSource = gac.getCampaignSource();
var gaMedium = gac.getCampaignMedium();
var gaName = gac.getCampaignName();
var gaTerm = gac.getCampaignTerm();
var gaContent = gac.getCampaignContent();

<!-- Construct action URL with campaign params -->
var actionURL = ""+ gaName +"&utm_source="+ gaSource +"&utm_medium="+ gaMedium +"&utm_content="+ gaContent;

<!-- Fire the form and post the data -->
function submitForm() {
	document.orderForm.action = actionURL;

So, when the user submits the order, it now credits all those campaign attributes in the ecommerce overview in Google Analytics!


Sorry if any of this is unclear, because I'm not really a programmer (I'm marketing); I am just hacking away at code that was delivered to us and only concerned with the end result, which is being able to see exactly how my campaigns perform.


I hope this was useful, as I would have LOVED a summary like this, but found nothing be people in the same boat with unanswered questions.


Let me know if you want more details.