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.

Pixel tracking conflict on Receipt?

GeoffreyGeoffrey Member
in Help edited June 2012
Hi guys. Geoffrey at Verdant Tea here. I'm in the process of integrating iDevAffiliate on our website. Think I've followed the integration instructions from the wiki clearly. I added the following code to the end of our Receipt template:
^^receipt_only_begin^^<img  style="float:left" border="0" src="https://verdanttea.com/idevaffiliate/sale.php?profile=43&idev_saleamt=^^order_total^^&idev_ordernum=^^order_id^^"; width="1" height="1">^^receipt_only_end^^

</body>
</html>

Now, the thing is I also have Google Analytics tracking on the Receipt page and that was working fine until I tried to add the iDevAffiliate tracking to the template as well. I just ran a small live transaction to test the iDev installation, but it is not tracking commissions yet. Google Analytics showed the it registered the sale. I neglected to inspect the page source on the receipt page immediately after completing the transaction, but I thought I could go back and look at the receipt page via the FoxyCart admin transactions log to check the source code and see wether the iDev pixel tracker was populating transaction data correctly.

When I tried to view the receipt page via the FoxyCart transactions log, it showed up as a blank page with only the background visible. I inspected the page source and found that the receipt page was only loading up to the code right before the end of the document head tags. It looks like this (note: I've obscured our GA account # for security):
<script type="text/javascript">
 
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
  _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>
 
</body>
</html>

In the receipt template, the code that should follow this place in the document is this:
^^receipt_only_begin^^
^^analytics_google_ga_async^^
^^receipt_only_end^^

</head>

<body id="checkout">...

When I remove this GA placeholder code from the template and try to view the order receipt via the transaction log again, everything shows up just fine. Inspecting the source then, I don't see any iDev pixel tracking code at the end of the document, but it is there in the template. Now, if I add the GA placeholder code back in and remove the the iDev pixel code, the order receipt page will also appear as it should when I view it through the transaction log. But for whatever reason, these two pieces of tracking code do not seem willing to coexist in the receipt template without causing the mentioned problem. Oddly enough, the order receipt page DID appear as it should when it loaded the first time immediately after order completion, but it would not appear correctly when trying to view it again in the manner that I've mentioned.

Is there any known problem with using the ^^receipt_only_begin^^ ^^receipt_only_end^^ placeholders more than once in the receipt template? In this case, I'm trying to use it in two instances, the first before the closing head tag (for GA tracking), and the second before the closing body and html tags (for iDev tracking). Am I doing something wrong here?

Also, this is a somewhat divergent issue, but I notice on the iDevAffiliate integration wiki that an https SSL certificate for the iDev installation is only required for FoxyCart versions prior to 0.7.0. I am using FoxyCart version 0.7.2. So in my case, should the iDevAffiliate tracking code be functional if it is in http as follows?
^^receipt_only_begin^^<img  style="float:left" border="0" src="http://verdanttea.com/idevaffiliate/sale.php?profile=43&idev_saleamt=^^order_total^^&idev_ordernum=^^order_id^^"; width="1" height="1">^^receipt_only_end^^

I assume that my first transaction to test this didn't log the sale because I had used https in the code when there isn't actually an SSL certificate for our iDev installation. We use a Rapid SSL certificate with custom domain for our checkout process (https://secure.verdanttea.com), which is what appears in the receipt url as well, so I assume the receipt page is secured. Is there any problem with having the iDev tracker send information to an unsecured address on the secured receipt page? Is there anything else I need to keep in mind here? I just want to make sure I can get this right before I try more live transactions to test it.

Any assistance on these matters would be deeply appreciated. Thanks!

Geoffrey
Comments
  • brettbrett FoxyCart Team
    Hi Geoffrey.
    So, you're right that you can't use the ^^receipt_only_begin^^ and _end^^ twice. But it should be an easy enough fix to stick the ^^analytics_google_ga_async^^ down in the block with your iDev img tag. The only key is that it comes before your main GA block. So it should look something like this:
    ^^receipt_only_begin^^
    ^^analytics_google_ga_async^^
    <img  style="float:left" border="0" src="http://verdanttea.com/foo/bar"; width="1" height="1">
    ^^receipt_only_end^^
    

    As far as the https goes, that'll be just fine on v0.7.2, since the receipt loads at http, so another request to http will load just fine.

    Give that a go and let us know if you have any issues.
  • Thanks Brett. I'll give this a try and let you know if it works.
  • It worked, Brett! Thanks so much.

    Geoffrey
Sign In or Register to comment.