Volusion – How to Add Google Analytics Code to Track E-Commerce Conversions

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.

I found that other tutorials about adding conversion tracking codes to your Volusion store involves editing Site Content #130. However, to implement my version, you only need to add the code in your Template_XXX.html file’s just before the </head> tag. If you have any scripts in #130, then you need to remove it otherwise, you will be double-counting 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:

volusion-conversion-tracking-code-on-template-page-asynchronous-code

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:

google-analytics-e-commerce-conversion-tracking-with-volusion

Related Posts

23 responses to “Volusion – How to Add Google Analytics Code to Track E-Commerce Conversions”

  1. Mariana Avatar
    Mariana

    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!!!!

    1. King Avatar
      King

      @Mariana you’re welcome!

  2. Richard Avatar
    Richard

    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!!!!!!!!!!!!!!!

    1. Chris Avatar
      Chris

      @Richard any luck figuring that out? I’m having the same issue…

  3. Josh Avatar
    Josh

    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!

  4. Josh Avatar
    Josh

    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.

  5. Josh Avatar
    Josh

    So did you leave the Goal tracking script on the order complete page 130?

    1. admin Avatar
      admin

      @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

  6. Kim Butler Avatar
    Kim Butler

    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?

  7. Kim Butler Avatar
    Kim Butler

    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?

  8. Nirav Avatar
    Nirav

    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 .

  9. Ninon Nguyen Avatar
    Ninon Nguyen

    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.

    1. King Avatar
      King

      Can you email me screenshots of your GA dashboard and the Conversions > Ecommerce report in the Standard reporting? ksrosales at gmail dot com

  10. Josh Avatar
    Josh

    What about for Bing Microsoft Ad Center? How do you get the tracking code to work ?

    1. King Avatar
      King

      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.

  11. geo Avatar
    geo

    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

  12. Josh Avatar
    Josh

    Install Bing’s yet? Thoughts on the “Enhanced” campaigns?

  13. Ginny Avatar
    Ginny

    Will this code track for conversions on AdWords campaigns, too?

    1. King Rosales Avatar
      King Rosales

      Yes, this is for all conversions.

  14. Matthew Avatar
    Matthew

    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!

  15. Rahim Avatar

    very helpful blog thanks for sharing it.

  16. David Avatar
    David

    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/

    1. King Rosales Avatar
      King Rosales

      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.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.