Patch (to be ported)
Project:
Ubercart
Version:
8.x-4.x-dev
Component:
3rd party integration
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
13 Jan 2014 at 12:29 UTC
Updated:
4 Mar 2015 at 17:11 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
neochief commentedComment #2
longwaveThanks for working on this.
Is there any way of supporting both the old and new versions at the same time, or detecting which one is in use? If I remember correctly we had to do something similar when Google introduced the asynchronous ga.js.
Comment #3
longwaveSeems like it would be safer to build the hash in PHP and then call drupal_json_encode() once for the entire thing?
Comment #4
neochief commentedThanks for review! How about this?
Comment #5
neochief commentedHere's the output of both versions:
<script>ga("require", "ecommerce", "ecommerce.js");ga("ecommerce:addTransaction", {"id":"23800","affiliation":"Site.com","revenue":19.95,"tax":0,"shipping":0,"city":"Girona","region":"Gitega","country":"Spain"});ga("ecommerce:addItem", {"id":"23800","sku":"Book1","name":"Book1","category":"No category","price":"19.95000","quantity":"1"});ga("ecommerce:send");</script><script>_gaq.push(["_addTrans", "23800", "Site.com", 19.95, 0, 0, "Girona", "Gitega", "Spain"]);_gaq.push(["_addItem", "23800", "Book1", "Book1", "No category", "19.95000", "1"]);_gaq.push(["_trackTrans"]);</script>Comment #6
sigveio commentedI've been using the patch in #4 and seem to be having an issue with incorrectly recorded referrals when external payment gateways are used (e.g. like PayPal, where the user is redirected off site and back). The payment gateway is recorded as the referral (and thus source for e-commerce transactions/goal completions) instead of the actual traffic source. We didn't have this issue prior to using #4, so I'm guessing it is due to a change in how the new Universal Analytics records referrals.
Anyone else struggling with this?
I'm going to try passing utm_nooverride=1 in the return URL of the payment gateway and see if that helps... but I'm unsure on whether it will have any effect in this case. It is supposed to tell GA to not update the referral when the user hits the landing page... but I can only find it in the ga.js documentation. Remains to be seen whether it applies to referrals outside a tracked campaign at all, and whether it still has any meaning with analytics.js.
Thought I'd mention it here as it's quite relevant when transitioning to analytics.js and tracking e-commerce... and might need some form of fancier work-around if the utm_nooverride=1 trick doesn't work.
Comment #7
sigveio commentedAh... never mind. They introduced a referral exclusion list for this purpose in Universal Analytics. Anyone interested in it can read more here: https://support.google.com/analytics/answer/2795830?hl=en
Comment #8
neochief commentedSo, can we move this one ahead?
Comment #9
philsward commentedWoohoo! After 15 days of not tracking my eCommerce, we've got data again! Patch #4 worked great. Thx!
Comment #10
longwaveCommitted to 7.x-3.x, thanks for the patch.
Comment #11
longwaveWill need porting to 8.x-4.x, though we can drop the old support there by the looks of it.
Comment #13
hass commentedI have added http://cgit.drupalcode.org/google_analytics/tree/googleanalytics.module?... for you to detect the version of Google tracker. Hope this helps.
Comment #14
gedur commentedMaybe you could consider integrating the analytics stuff with the ga_push module https://www.drupal.org/project/ga_push for the 7.x branch (8.x branch is not stable already).
This way it could send metrics to google with php or js out of the box. The PHP (server-side method) is useful for payments like paypal where the customer does not need to come back again to the site and the JS method does not trigger the callback to google, in this case the server-side method is triggered on the paypal payment confirmation.
The ga_push module is already integrated and working on commerce_google_analytics.
Comment #15
longwave@GeduR: Can you open a new feature request for that? This ticket is now only for adding Universal Analytics support to 8.x-4.x.
Comment #16
ivanstegic commentedWe've been running an Ubercart site for a client that we upgraded to Universal Analytics and backported the D7 patch to Drupal 6. This patch works on version 6.x-2.13 of uc_googleanalytics and we are currently using it on a live site. Posting it here for others that might come looking for it.
Comment #17
ivanstegic commentedMy apologies, I updated the reverse patch in #16 above. Here's the actual patch for Drupal 6's version of uc_googleanalytics. So sorry about that.
Comment #18
ivanstegic commentedI went ahead and created a separate issue for D6 that has this patch on it -- hopefully it gets merged into dev. It's here: https://www.drupal.org/node/2343767
Comment #19
haysuess commentedI've been using a version of Ubercart with the patch in #4 already included, and am still getting no eCommerce tracking. I found this: https://www.drupal.org/node/2387997
It appears there is something else that needs changing? I just updated my uc_googleanalytics.module code with the code in the above link. We'll see if that fixes it.