Missing Transactions? Improve accuracy of Paypal and GA Ecommerce integration

Missing Transactions? Improve accuracy of Paypal and GA Ecommerce integration

checkout the end of post for an easier method. :)

Usually when we need to implement google analytics for a site using 3rd party hosting shopping cart its simple enough. The general method to achieve this is to do cross domain tracking. This requires a little code change to tell google analytics to send cookie information of the visitor to the checkout domain.

Because Paypal does not allow you to add analytics tracking to its pages we can't use cross domain tracking, instead we have to wait for a user to come back to the site and then trigger a sale.

There's a simple method using Paypal PDT to do this  once the user completes the purchase through paypal and returns to the site order information from paypal is retrieved, ecommerce tracking is triggered and sales information is sent to google.  In about 85-90% of cases user returns to the site successfully and we can trigger a transaction. But those 10-15% of times a user closes the page after completing the order, is where the trouble lies. That's a lot of information about customers getting lost. This is exactly the problem we faced recently.

To get around this, we built an alternate 100% accurate tool using  Paypal IPN api,  we can use it to trigger a sale regardless of whether a customer comes back to the site or not.

To make this work we started with identifying a user when they leave for paypal to make a purchase. This is essential because we need to be able to connect a user's initial behavior [where they came from, what they clicked etc] with the final purchase. Because the user may or may not come back its essential to have a way to identify users.

Second we configured IPN to send alerts whenever a transaction was completed. Using the information from the transaction and the unique identifier we configured in the first we had all the data we needed to tell Google Analytics about the order.

Now all we needed to send this information to GA. That was done using a php based version of GA, that allowed us to send all the data to google analytics as they came in.

End result is a completely accurate google analytics ecommerce integration with paypal. For an added bonus this can also be used to process refunds :) and even recurring orders.

If the site is new and just staring out the first solution using PDT should be enough, but for a big enough 10-15% of paypal orders means losing out on a lot of insights and that's where something like this would come in very handy.

 Ps. We ended up writing a very neat tool in a recent hackathon that could be integrated into almost any site or even work with other 3rd party solutions like Clickbank, Worldpay. It turned out to be a fun exercise helping us quickly master paypal ipn, curse paypal's documentation and use some server side google analytics tools. Let's talk if you need help setting up something similar.

Hussain Mehmood

Hey I am Hussain Principal Analytics Consultant @ MarketLytics focusing on measurement strategy and analytics implementation. I started marketlytics in 2010 to turn my passion for understanding user behaviour into my day job. I use & extend google analytics, tag manager and kissmetrics everyday to deliver performance measurement & data driven insights.