Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Anyone see a problem with this Receipt tracking code?

joelataylorjoelataylor Member
in Help edited August 2012
Just wanted a couple of extra eyes on this, as GA tracking is not working. I hate GA as I have to WAIT for the results to actually display.

Does anyone see anything wrong with this in my receipt template footer?
<script type="text/javascript" charset="utf-8">
	if (window.location.hash.search(/utma/) == -1 && typeof(fc_json.custom_fields['ga']) != "undefined") {
		if (fc_json.custom_fields['ga'].length > 0) {
			window.location.hash = fc_json.custom_fields['ga'].replace( /\&amp;/g, '&' );
		}
	}
</script>

<script type="text/javascript">
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-34422035-1']);
	_gaq.push(['_setDomainName', 'none']);
	_gaq.push(['_setAllowLinker', true]);
	_gaq.push(['_setAllowAnchor', true]);
	_gaq.push(['_trackPageview', '/receipt']);

	(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>
 
^^receipt_only_begin^^
^^analytics_google_ga_async^^
<img border="0" src="http://stickerobot.com/affiliates/sale.php?profile=43&idev_saleamt=^^subtotal^^&idev_ordernum=^^order_id^^"; width="1" height="1">
<!-- Google Code for Sale Conversion Page -->
<script type="text/javascript">
	var google_conversion_id = 1010012724;
	var google_conversion_language = "en";
	var google_conversion_format = "3";
	var google_conversion_color = "ffffff";
	var google_conversion_label = "cNKZCLyj4gIQtKTO4QM";
	var google_conversion_value = ^^subtotal^^;
</script>
<script type="text/javascript" src="https://www.googleadservices.com/pagead/conversion.js"></script>;
<noscript><div style="display:inline;"><img height="1" width="1" style="border-style:none;" alt="" src="https://www.googleadservices.com/pagead/conversion/1010012724/?value=^^subtotal^^&amp;label=cNKZCLyj4gIQtKTO4QM&amp;guid=ON&amp;script=0"/></div></noscript>;
^^receipt_only_end^^
Tagged:
Comments
  • Ok, I've confirmed that this is definitely working in GA. So it should be working in Google AdWords.
  • Hi Joe,

    I see you've got setDomainName set to None. Is you're cart on a subdomain of your main site or another domain e.g. domain.foxycart.com?

    Ours is on another domain i.e. xxxx.foxycart.com so we have set things up according to Google documentation where it states the setDomainName should be set to the relevant domain.

    Did you have setDomainName = None on both Site Pages and FoxyCart templates or just FoxyCart?

  • fc_adamfc_adam FoxyCart Team
    @nratsey,

    You should follow our documentation here: http://wiki.foxycart.com/integration/googleanalytics_async - you do actually want to set 'setDomainName' to none as noted in our docs.
  • nratseynratsey Member
    edited January 2013
    Hi Adam,

    Thanks for response. We have now set it up as detailed in that Wiki and we are now seeing data. It doesn't actually say in that article what setDomainName should be set to in the tags on the site e.g. should it be the main domain - _gaq.push();

    We are using a Wordpress plugin to include the GA tags and in enabling cross domain tracking (i.e. to get the setDomainName method included in the tags) the value defaults to the site domain so we have our site tags with a value as above and the tags on the cart pages set to none.

    As I said we are getting data but is this setup OK from your pov?

    One thing we have noticed is that we have got a few referrals from subdomain.foxycart.com in our traffic data. Is that from people who are clicking to 'continue shopping' from either the cart or checkout area and the session information is not being maintained?
  • fc_adamfc_adam FoxyCart Team
    @nratsey,

    As long as your set up mirrors what's detailed on the wiki, and you're getting complete data, you should be fine.
  • Hi Adam, That's the point I was making, that unless I missing it, the wiki doesn't detail what the site tags should be when it comes to the value for setDomainName.

    I went through checking the cookies that were being set and looked at the utma values and they do differ slightly at the front of the string but I'm assuming that's alright as that's the piece that refers to the domain:

    main domain: 130477390.319051186.1358252294.1358252294.1358252294.1
    foxycart subdomain: 1.319051186.1358252294.1358252294.1358252294.1

    Cheers
  • brettbrett FoxyCart Team
    @nratsey, sorry for my delayed response, but for the record, it appears that some of the GA behavior has changed since we created that documentation. To be honest, the GA stuff gets _so_ complex so quickly that I'm not sure when we'll be able to revisit it, but if you're collecting data as you should be, that's the most important part.

    I'm not entirely sure, but I believe the change has to do with the setAllowHash default settings in GA, which may give a little more flexibility. I could be wrong on that though :)
Sign In or Register to comment.