After changing my Google Analytics module to use the latest & greatest code, I noticed that our visits improved, but our Goals and Ecommerce reports went down. After further investigation I realized that the uc_googleanalytics module is using the old (Legacy) version of the tracking code from Google.
So I've added conditionals that check for whether Legacy is selected in the Google Analytics Drupal modue (googleanalytics.module) and if it's set to TRUE uses the normal Legacy code; otherwise it will use the new format for assembling the Transaction and Item code. (They are arrays now).
PLEASE NOTE: I've just installed this today and I'm waiting to see how our reports do (and especially if they come back). So it should be noted that, while I can confirm the code itself works, I'm waiting to see if it has the positive impact on our Analytics as I'm hoping it will. Even so I figured I would attach my module, so that others can test as well - especially if they run into the same problem I did.
Hope this helps!
Old:
<form style="display:none;" name="utmform">
<textarea id="utmtrans">UTM:T|[order-id]|[affiliation]|
[total]|[tax]| [shipping]|[city]|[state]|[country] UTM:I|[order-id]|[sku/code]|[productname]|[category]|[price]|
[quantity] </textarea>
</form>New:
<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>| Attachment | Size |
|---|---|
| uc_googleanalytics-1.1.tar.gz | 2.47 KB |








Joined: 08/14/2007