Volusion is very secretive about how to integrate analytics ecommerce tracking into your volusion store; paying them $150/hour because, A) you can’t do it yourself or B) you don’t want to, is what they’re hoping for. In fact, the same is true with mostly any customization of their code as well.
About a month ago, I came across some code, but it used older Google Analytics tracking code. As there is nothing wrong with it, it works just fine, the problem was that if I wanted to do anything else with Google Analytics, ie. track events with:
onClick="_gaq.push(['_trackEvent','Main Menu','Click','Baby Strollers']);"
… it wouldn’t work.
So, I took the code and made it compatible with the Asynchronous JavaScript version of Google Analytics to track both Visitors & E-Commerce conversions.
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25344799-1']);
_gaq.push(['_setDomainName', 'ledsplus.com']);
_gaq.push(['_trackPageview']);
if ( typeof Order !== 'undefined' ) {
_gaq.push(['_addTrans',Order[0], '', Order[2], Order[4], Order[5], Order[6], Order[7], Order[8]]);
for (var i=0; i<OrderDetails.length; i++) {
_gaq.push(['_addItem',OrderDetails[i][0], OrderDetails[i][2], OrderDetails[i][3], OrderDetails[i][4], OrderDetails[i][5], OrderDetails[i][6]]);
}
_gaq.push(['_trackTrans']);
}
(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>
Here’s what my template_xxx.html page looks like (I put my code just before the </body> tag:
Once you’re done and had some actual conversions happen on your site, you should be able to see this in your Google Analytics account under E-Commerce > Overview:
Hi,
Just what I was looking for! I’m trying it out…I’ve been going crazy trying to get ecommerce tracking set up…
Thanks!!!!
@Mariana you’re welcome!
Can’t get it to work. Once I add your code into the google std ajax, I lose the ability to track page load, and transactions are not picked up. If I remove your addition in the middle, it comes back up… will try and debug now and let you know if I crack it.
Thanks, this is a much cleaner way of handling volusion, that’s for sure!!!!!!!!!!!!!!!
@Richard any luck figuring that out? I’m having the same issue…
Excellent! I was looking for the code for the new Asynchronous Syntax.
I also was having the double counting issue. I will try putting it in the html file instead.
Looks like you are not using the [i] for the Trans elements… I think this is where the code I tried may have error-ed as well. Thanks for this!
I also didn’t have these lines in the code I used:
if ( typeof Order !== ‘undefined’ ) {
for (var i=0; i<OrderDetails.length; i++) {
How did you know to add these? I just talked to Google support and they said that the code only needs to be on the checkout page. Although if editing Article 130 only allows for the body and not the head then I guess editing the HTML template file is the only way.
From my understanding the new Asynchronous version should remove the double counting issue. I think I might try it in the 130 file with your code first to see if that works.
So did you leave the Goal tracking script on the order complete page 130?
@Josh, my code won’t work by having it on page 130, it will double count.
I got this code: if ( typeof Order !== ‘undefined’ ) {
for (var i=0; i
I’m confused by your instructions. In the blue box you say to add the code before the tag (which is where GA says to add the normal script), but in the screen shot and with the instructions just above the screen shot, you say to add the code before the tag (which is where GA says to add the ecommerce script). Where are you saying to add it?
Sorry, my previous message was changed by the system.
I’m confused by your instructions. In the blue box you say to add the code before the head tag (which is where GA says to add the normal script), but in the screen shot and with the instructions just above the screen shot, you say to add the code before the body tag (which is where GA says to add the ecommerce script). Where are you saying to add it?
Hey thanks for help , i had an issue when i put your code in the body of template , and it did not work ,
than i made a small change and it worked
The change i made : _gaq.push([‘_addTrans’,Order[0], ”, Order[2], Order[4], Order[5], Order[6], Order[7], Order[8]]);
replaced double quotes with two single quotes
” with ‘ ‘ and it worked like charm .
I tried the code above on our site, both from info side and online store side. We only get traffic report but we don’t get any of conversion rate or show any purchases. Please help.
Can you email me screenshots of your GA dashboard and the Conversions > Ecommerce report in the Standard reporting? ksrosales at gmail dot com
What about for Bing Microsoft Ad Center? How do you get the tracking code to work ?
Hi Josh, I haven’t installed bing’s tracking conversion code yet and maybe not soon.
I will eventually for my volusion store can email you when I do.
I have tried for month to set up the async tracking in my volusion store. Did try everything mentionned but nothing works, As long as I excluded the part :
if ( typeof Order !== ‘undefined’ ) {
_gaq.push([‘_addTrans’,Order[0], ”, Order[2], Order[4], Order[5], Order[6], Order[7], Order[8]]);
for (var i=0; i<OrderDetails.length; i++) {
_gaq.push(['_addItem',OrderDetails[i][0], OrderDetails[i][2], OrderDetails[i][3], OrderDetails[i][4], OrderDetails[i][5], OrderDetails[i][6]]);
}
_gaq.push(['_trackTrans']);
}
I see visits and other standard indicators, but as soon as I paste it I get no data at all.
Did put it in the template before body closing tag and tried sigle and double quote….nothing will do! Would really appreciate any help!
thanks
claire
Install Bing’s yet? Thoughts on the “Enhanced” campaigns?
Will this code track for conversions on AdWords campaigns, too?
Yes, this is for all conversions.
Hello King,
First of all thanks for this! I found this page googling for instructions on how to add google analytics to my volusion site. I found another tutorial on a different site that provided code to article #130, but that isn’t working. My site still reports no commerce on Google Analytics. Are these instructions you’ve given here still valid 3.5 years later? If so, could you clarify: are you saying add your first snippet of code to Template_XXX.html before the tag and the second snippet of code (that you’ve provided as a .png file) to Template_XXX.html before the tag? I hope you see this and can help me!
very helpful blog thanks for sharing it.
Note that this code is older now and this code would work better with V1 code with tracking down to the item level:
https://jsfiddle.net/reax2ez0/3/
Hi David, thank you. Yes, this code is likely now legacy code. When I find some time, I will update this post. I don’t have an active volusion account, so hopefully I can find some details on the a current version.