Re: Re: uc_googleanalytics doesn't work with Latest GA Tracking

Posts: 1314
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

Well this code didn't fix anything. My only guess is that it's because I had to enclose the transaction script in new tags. I'm not sure how to get it to be combined with the ga.js code that's normally found at the bottom of the html source.

The current uc_googleanalytics module (using the Legacy code) puts the transaction information into a form. The new version of the code doesn't require this. It only requires that you add calls to _addTrans, _addItem, and _trackTrans but these have to be appended to the regular call to the ga.js tracking script.

If anyone has any ideas, please let me know. Otherwise I'll just switch the site back to Legacy code I guess. (Bummer)

EDIT: Complete example from Google.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
  var pageTracker = _gat._getTracker("UA-XXXXX-1");
  pageTracker._initData();
  pageTracker._trackPageview();

  pageTracker._addTrans(
    "1234",                                     // Order ID
    "Mountain View",                            // Affiliation
    "11.99",                                    // Total
    "1.29",                                     // Tax
    "5",                                        // Shipping
    "San Jose",                                 // City
    "California",                               // State
    "USA"                                       // Country
  );

  pageTracker._addItem(
    "1234",                                     // Order ID
    "DD44",                                     // SKU
    "T-Shirt",                                  // Product Name
    "Green Medium",                             // Category
    "11.99",                                    // Price
    "1"                                         // Quantity
  );

  pageTracker._trackTrans();
</script>

EDIT EDIT: I may have found that I had extra commas at the end... I know this can sometimes break JS so I am testing again. Will update tomorrow.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

uc_googleanalytics doesn't work with Latest GA Tracking code! (Fix attached) By: torgosPizza (32 replies) Thu, 03/06/2008 - 14:15