38 Replies Latest reply on Jan 25, 2015 3:08 AM by spreadman

    How to set up Google Analytics Ecommerce Tracking for BC

    Justin Brock Level 1

      I've successfully added ecommerce tracking for Google Analytics to my Business Catalyst sites. I haven't found any [free] definitive guides out there, so I thought I'd share.

      Business Catalyst files

      For the tracking script, the Business Catalyst file you need to have opened is /Layouts/OnlineShop/order_receipt-US.html.

      However, you also need to add the Google analytics script - with out the ecommerce modification - to all the pages on your site. I recommend putting in the <head> of your page templates.

       

      Google Analytics Ecommerce Tracking

      To start tracking Business Catalyst ecommerce transactions with Google Analytics, here are the steps you need to take.

      1. Log into Google Analytics and navigate to the profile settings page for the Business Catalyst site. Under "Ecommerce Settings" select "Yes, this is an E-Commerce Site".
        google-analytics-1.png
      2. While still in analytics, go to the "Tracking Code" tab under your profile. Don't grab the code from the Standard tab. Instead, select "Advanced". 
        • When someone goes through the cart on a Business Catalyst site, the domain switches to *.worldsecuresystems.com. So you need to select "Multiple top-level domains".
        • I would also select the check boxes for AdWords campaigns, DoubleClick data and Track online ad campaigns from other providers
        • The script Google shows you on this page is what you should put on all your page templates.
          google-analytics-2.png
      3. Now you're ready to grab that code and modify it for ecommerce tracking.
        • The code given in Google Analytics should go on all the pages of your website. The easiest way to accomplish that is to put it on all your templates. However, there's one more step.
        • You then need to modify the code for your receipt page as shown below. Finally, place that modified code on the /Layouts/OnlineShop/order_receipt-US.html page. Here's what it should look like modified. [You'll need to close the script tags, of course.]
              
                      
                  script type="text/javascript"
                  var _gaq = _gaq || [];
                  _gaq.push(['_setAccount', 'UA-*******-*']);  // your Google Analytics profile id
                  _gaq.push(['_setDomainName', 'example.com']); // your domain name - not *.worldsecuresystems.com, but the domain you've chosen for your site
                  _gaq.push(['_setAllowLinker', true]);
                  _gaq.push(['_trackPageview']);
                  _gaq.push(['_addTrans', "{tag_orderid}", // Order ID
                             "", // Affiliation
                             "{tag_amount}", // Total
                             "", // Tax
                             "", // Shipping
                             "", // City
                             "", // State
                             "" // Country
                            ]);
                  _gaq.push(['_trackTrans']);
                  
                  (function() {
                      var ga = document.createElement('script');
                      ga.type = 'text/javascript';
                      ga.async = true;
                      ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
                      var s = document.getElementsByTagName('script')[0];
                      s.parentNode.insertBefore(ga, s);
                  })();
              /script

      Result

      You won't see all the details about the purchase in Google Analytics. That's because Business Catalyst does not pass all the needed variables to the order receipt page. [Perhaps that's a feature request.]

       

      However, it's still valuable to know the order ID and revenue in Google Analytics - knowing which sources drive your revenue is critical. It's also pretty easy to grab the order ID [under Ecommerce > Transactions in Google Analytics] and look in your Business Catalyst site for the order. Here's a screenshot of the results I saw on the first day. 

       

      Ecommerce Overview   Google Analytics.png