Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdating Big Commerce to the new analytics.js
    text
    copied!<p>I'm working on a site and I updated the tracking code to the new analytics.js I transferred their site and everything is working except for conversion. It's a Big Commerce site so I can't touch server side script but this what they generate</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { if(typeof(pageTracker) != 'undefined') { pageTracker._addTrans( '358', 'Backyard Toy Company ', '0.01', '0.00', '0.00', 'Lakewood', 'New Jersey', 'United States' ); pageTracker._addItem( '358', '1336', 'test', '', '0.01', '1' ); pageTracker._trackTrans(); } }); &lt;/script&gt; </code></pre> <p>I updated the client side code to this</p> <pre><code> ga('require', 'ecommerce', 'ecommerce.js'); // Load the ecommerce plug-in. // START CUSTOM CODE function old2new() { // define object that can route old methods to new methods this._addTrans = addTrans; this._addItem = addItem; this._trackTrans = trackTrans; } function addTrans(orderID,store,total,tax,shipping,city,state,country) { // remap _addTrans ga('ecommerce:addTransaction', { 'id': orderID, 'affiliation': store, 'revenue': total, 'tax': tax, 'shipping': shipping, }); } function addItem(orderID,sku,product,variation,price,qty) { // remap _addItem ga('ecommerce:addItem', { 'id': orderID, 'sku': sku, 'name': product, 'category': variation, 'price': price, 'quantity': qty }); } function trackTrans() { ga('send', 'ecommerce'); } // instantiate converter using name of old Google tracking object // bigcommerce code will use this and be none the wiser var pageTracker = new old2new(); // END CUSTOM CODE </code></pre> <p>I'm sorry I'm a newbie, but I looked all over can't figure out why it's not working.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload