Skip navigation
FTS95
Currently Being Moderated

Google Analytics for Ecommerce

Apr 23, 2012 2:55 PM

Tags: #google #analytics #google_analytics

Hello,

 

I was wondering if someone can guide me in inserting google analytics into my Business Catalyst website. Here is the generic code from Google Analytics website:

 

<html>
<head>
<title>Receipt for your clothing purchase from Acme Clothing</title>
<script type="text/javascript">

 
var _gaq = _gaq || [];
  _gaq
.push(['_setAccount', 'UA-XXXXX-X']);
  _gaq
.push(['_trackPageview']);
  _gaq
.push(['_addTrans',
   
'{tag_orderid}',      // order ID - required
   
'Acme Clothing',  // affiliation or store name
   
'{tag_amount}',    // total - required
   
'1.29',           // tax
   
'5',              // shipping
   
'San Jose',       // city
   
'California',     // state or province
   
'USA'             // country
 
]);

  
// add item might be called for every item in the shopping cart
  
// where your ecommerce engine loops through each item in the cart and
  
// prints out _addItem for each
  _gaq
.push(['_addItem',
   
'1234',           // order ID - required
   
'DD44',           // SKU/code - required
   
'T-Shirt',        // product name
   
'Green Medium',   // category or variation
   
'11.99',          // unit price - required
   
'1'               // quantity - required
 
]);
  _gaq
.push(['_trackTrans']); //submits transaction to the Analytics servers

 
(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>
</head>
<body>

  Thank you for your order.  You will receive an email containing all your order details.

</body>
</html>

 

I understand I need to replace the company information with tags and in the above code I have done this for {tag_orderid} and {tag_amount} then added this code to the receipt - Buy Module Template Layout. It is now tracking the amount of the transaction, but of course the productname and other variables aren't there.

 

How do I do this and can I add additional tags in the Receipt - Buy module layout? If so, what are the tags; if not, where and how do I insert the relevant code.

 

Any help greatly appreciated.

 

Cheers Fenwick

 
Replies
  • Currently Being Moderated
    Apr 24, 2012 4:18 PM   in reply to FTS95

    Hi Fenwick,

     

    Currently BC doesn't have the actual product purchase information available at this stage in the transaction (Receipt Page), as the product purchase information is only available in the Shopping Cart Summary page. And you can't use the {webform_results} with this module.

     

    I've never managed to get the actual product details with the few quick test I've done like spanning the google transaction across the pages from the data generated at the summary page using cross-domain tracking.

     

    One alternative option is to use cookies to store the order information at the shopping cart summary page and then re-use them at the receipt page. It's a lot of extra work as you'll need to update the cookies if they make changes to their order and only commit if their order is successful, but will just depend on how much you want the data to show up in GA and how accurate you want the data to be.

     

    Another (just as bad for other reasons) option is to put the code on the shopping cart page and tinker with some custom order ID's.

     

    Either way you'll need to run JS. Kiyuco have a good tutorial in setting this up.

     

    It's on the wishlist.

     
    |
    Mark as:
  • mario_gudelj
    1,576 posts
    Oct 13, 2010
    Currently Being Moderated
    Apr 25, 2012 5:16 PM   in reply to Gary Swanepoel | ITB
     
    |
    Mark as:
  • Currently Being Moderated
    May 8, 2012 11:19 AM   in reply to mario_gudelj

    Actually, I know you can set up GA conversions in BC, but to my knowledge, you cannot easily configure to have e-commerce data passed in. There was a long thread on this in the old forums. Mario - the link you pasted is a good one but just allows GA to accurately measure visitors from the basic domain to the worldsecuresystesm.com domain.

     
    |
    Mark as:
  • mario_gudelj
    1,576 posts
    Oct 13, 2010
    Currently Being Moderated
    May 8, 2012 4:50 PM   in reply to apokrisis

    I followed those GA topics on the old forums and there were 3 long threads on them, but no one actually posted a code that I could share with everyone. It was all "i thinks" and "maybes". You practically have to tie in a function call to the checkout button and the first time I've seen someone actually do it is those kiyuco guys.

     

    -mario

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 26, 2012 9:21 PM   in reply to mario_gudelj

    There was this KB article though: http://kb.worldsecuresystems.com/235/bc_2355.html

     

    The following code example illustrates how to add the tags to the Google tracking code:

    http://kb.worldsecuresystems.com/235/bc_2355/images/tag_attributes.png

      pageTracker._addTrans(
    "{ tag_orderid}",            // Order ID
    "",                      // Affiliation
    "{ tag_amount}",             // Total
    "",                      // Tax
    "",                      // Shipping
    "",                      // City
    "",                      // State
    ""                    // Country );

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2012 3:26 PM   in reply to Justin Brock

    Can anyone confirm if they have been able to get this to work? I have had a number of conversation with the SimpleFlame guys, and pretty sure that without using some spiffy API set-up, that e-commerce tracking (AKA - product info, price, etc) is not possible.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2012 5:15 PM   in reply to apokrisis
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points