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

Posts: 47
Joined: 08/08/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.Not Kulvik

Did you get it to work?

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.
This shouldn't really be a problem?
Can't you just do like this for ordinary pages (this is what I guess you already do):

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

Then, when you hit the order complete page, you just append this at the end of page (just like how old legacy form is appended to the end of the page). The pageTracker variable is already declared in the previous javascript code:

<script type="text/javascript">
  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>

--

Erlend Strømsvik
Ny Media AS
erlend@nymedia.no

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