I have Google Analytics 7.x-1.2 and Ubercart Analytics 7.x-3.0 modules installed.

Google Analytics reports normal page tracking fine but doesn't give any data on sales or other ubercart activity.

I can't see any sales/commerce settings on the main Google Analytics config screen admin/config/system/googleanalytics (not sure if I should or not).

I looked through the bug tracker here and there are some older issues that sound the same but they are marked as 'fixed' so I'm assuming that the latest versions of both modules should have this working. Eg http://drupal.org/node/1266638

Is this the right place to report this?

Comments

longwave’s picture

What payment method are you using?

longwave’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)
JmsCrk’s picture

Status: Postponed (maintainer needs more info) » Active

We're using PayPal Website Payments Standard.

JmsCrk’s picture

Should I see sales or commerce settings on the main Google Analytics config screen? It's got many other categories.

longwave’s picture

No, there are no settings needed. However when using PayPal WPS, sales are not tracked in GA unless the user clicks back to the site after payment - which many users do not do. There is no easy solution to this, unfortunately.

longwave’s picture

Title: Google Analytics not working » Google Analytics not reliable for PayPal WPS
Category: support » feature

http://www.analyticsresults.com/2010/02/tracking-paypal-with-google-anal... contains some code that could be implemented in PayPal WPS so tracking is more reliable.

JmsCrk’s picture

Thanks for the help longwave

But as far as I'm aware Paypal always automatically redirects back to the site, with a note saying what is happening. The orders are marked as 'Payment Received' in Ubercart so they must be coming back to the site.

JmsCrk’s picture

On the last checkout page before I'm redirected I have the analytics code of:

<script type="text/javascript">
<!--//--><![CDATA[//><!--
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-nnnnnnnn-1"]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();
//--><!]]>
</script>

I checked and I do have to click through to get back to the site - which I didn't think was the case, but anyway - this is the code I see when I do click through after paying:

<script type="text/javascript">
<!--//--><![CDATA[//><!--
var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-nnnnnnnn-1"]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script");ga.type = "text/javascript";ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga, s);})();
//--><!]]>
</script>

Basically, it looks the same and doesn't seem to have anything to do with the cart, products, SKUs or anything at all.

How is this module meant to work? Should there be some reference in there to cart contents etc?

JmsCrk’s picture

I've found http://drupal.org/node/1311198 that has a walkthrough of how to set up paypal so that it returns to the site automatically - looks like it's a setting within paypal itself.

I'll try to set this up and see if it helps.

JmsCrk’s picture

I set up the return URL and, for anyone else following along, to get it working I had to:

  • Update the settings in the Paypal account with the return URL and no IPN
  • Update to 7.x-3.x-dev version of Ubercart (3.0 doesn't seem to work for the return URL)
  • Enable "Log in new customers after checkout." in Anonymous checkout, in Ubercart

It now gives me a much nicer message when automatically returning to the site after paying, and it also appends this code near the bottom of the markup:

<!--//--><![CDATA[//><!--
_gaq.push(["_addTrans", "84", "StoreName", "0.5", "0", "0", "", false, "Australia"]);_gaq.push(["_addItem", "84", "TestSKU001", "Test product", "No category", "0.50000", "1"]);_gaq.push(["_trackTrans"]);
//--><!]]>

This looks like it is tracking in Analytics, so I assume it is working correctly!

However, I'll leave this as 'active' in case you want to address the additional measures linked to above. If not, please close this.

Thank you :D

longwave’s picture

Glad to hear you got it working :)

I will leave this open for now as perhaps we should add a warning if both PayPal WPS and Google Analytics are enabled, or some configuration to automatically use Auto Return rather than having to manually configure it.

longwave’s picture

Category: feature » support
Status: Active » Fixed

There is actually not much more we can do here. If the user closes their browser after seeing that their PayPal WPS payment was successful, there is no way we can track that in Analytics.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.