Using Google Analytics eCommerce tracking on PayPal

Why to track PayPal transaction with Google Analytics

This article is important because Google Analytics provides a very attractive set of features (almost irresistible) for tracking ecommerce sales free of cost. It could tell not only how much sales happened, but, sources that send more customers than visitors, ways to improve traffic of valuable visitors, weakest links on your website that drive a visitor (ready to buy) away from your website, in other words all that you need to know or do to improve sales on your eCommerce, and if it is already great then GA shows your greatness

Evidently this tool is more than a cash register and eCommerce owners find it worth giving it a shot – that is invest some time and effort in Google Analytics eCommerce tracking. In the previous article I spoke about how you could go about one and this one is a deeper dive into one area that could be a problem- That’s if your eCommerce is not on your site but on PayPal. So let’s get started.

To set the context- You are a merchant using PayPal. You have merchandise on your eCommerce and a button called Buy now. On clicking this button a visitor will reach the PayPal window. On PayPal you will have to log in, verify card details, billing and shipping info and have you submit order. Somewhat like the picture here.

Now Google Analytics eCommerce tracking starts with placing its tracking code on each of these stages- but unfortunately PayPal does not allow that. All that PayPal allows is tracking it after the transaction is complete. Ahead you will find the two methods you could use, a brief comparison and how to implement.

What Info can Google Analytics get from Paypal

There are different ways to connect Paypal and  Google Analytics. There are some automated  tool  that take care of this process end to end, of course at a fee and there is a a redirecting method from Paypal that send you in formation of a successful transaction to your website. And since your website has Google Analytics tracking code, the information is also sent to the tool for reporting as well. Question is – what information is sent and is it worth the while collecting . Well it is debatable. So here is a comparison and  analysis of what you get.

The type of info you will receive depends on the method you adopt to collect it. There are two methods to collect transaction information from the eCommerce website.

1. Payment Data Transfer (PDT)

2. Instant Payment Notification(IPN)

Comparing PDT and IPN
    Payment Data Transfer Instant Payment Notification
1 Information Time lag Sends transaction data as soon as customers are redirected back to the website there is a material lag between the time a customer completes payment and the time your   site receives notification of this event
2 Accuracy Fails to deliver information if customers are not directed automatically  like during Network Issues or customer closing window IPN resend a confirmation until your site acknowledges receipt. Uses a IPN Listener and never fails reporting any transaction.
3 Security A carelessly written PDT script will allow duplicate orders or downloads as users/buyers/customers get to see the URL and an unscrupulous user can try to revisit and generate multiple orders without paying for them again- This is nothing to do with Google Analytics but definitely affects buiness. So a note. Notification URL remains hidden from customers and other users which helps keep things in order and secure
4 Information Sent PDT sends amount of transaction currency codes, custom message , transaction status, Transaction ID.

This is just order confirmation

IPN has a list of transaction types. For example a buyer information variable, payment info variables etc. 
5 Coding and Set up Simple set up – minimum coding Coding to create listener . Google Analytics should connect with the listener to collect information

Besides, Paypal always recommends, IPN over PDT.

How to Set up PDT ? How to connect Google Analytics?

The eCommerce tracking set up  using PDT consists of 3 parts-

1.       on PayPal

2.       on Google Analytics

3.       on your Website

On Paypal

·         Log into PayPal account;

·         Click on the “Profile” link under the “My Account” tab;

·         Click on “Website Payment Preferences” on your right under “My Selling Tools”;

·         Set “Auto Return” to ON and enter the URL of your ecommerce thank-you page; (Please create a Thank you page if you donot have one)

·         Add “?utm_nooverride=1” to the end of your URL. This ensures that transactions (i.e., conversions) are credited to the original traffic source rather than to PayPal.

·         PayPal Auto Return for website payments.

·         Set “Auto Return” to ON and enter the URL of your ecommerce thank-you page.

On Google Analytics

·         Set up a new Goal for Thank you page- the page where a customer is redirected  from PayPay after Transaction. Visit Destination Goals

·         Enable eCommerce Tracking

·         Create a event type Goal for PayPal Buy Now button. Check out how to create a goal. Use these values for Goal Description Section when you reach that.

Category – Button

Action – Clicked

Label (optional, but recommended) – PayPal Buy Now

Value (optional)

On Your Website

·         Track your PayPal – Buy Now button to enable event tracking

<input onClick=”ga(‘send’, ‘event’, { eventCategory: ‘’, eventAction: ‘Buy Now button’});“

type=”image” src=”” border=”0″ name=”submit” alt=”PayPal – The safer, easier way to pay online.”>

·         Modify your “thank-you” page to retrieve the PayPal data that will be transferred using either the POST of GET methods

ga('ecommerce:addTransaction', {
 'id': '1234',                     // Transaction ID. Required.
 'affiliation': 'Acme Clothing',   // Affiliation or store name.
 'revenue': '11.99',               // Grand Total.
 'shipping': '5',                  // Shipping.
 'tax': '1.29'                     // Tax.
 ga('ecommerce:addItem', {
 'id': '1234',                     // Transaction ID. Required.
 'name': 'Fluffy Pink Bunnies',    // Product name. Required.
 'sku': 'DD23444',                 // SKU/code.
 'category': 'Party Toys',         // Category or variation.
 'price': '11.99',                 // Unit price.
 'quantity': '1'                   // Quantity.

IPN Tracking for Google Analytics

The way IPN work is:

The numbers in diagram correspond to the following steps:

1. The button action starts a payment that completes on PayPal

2. PayPal sends IPN listener a message that notifies you of the event

3. The listener sends the complete unaltered message back to PayPal; the message must contain the same fields in the same order and be encoded in the same way as the original message

4. PayPal sends a single word back, which is either VERIFIED if the message originated with PayPal or INVALID if there is any discrepancy with what was originally sent

5 Connect the listener to Google Analytics and have it receive all the transactional information.

There are further details to this which will be covered in another article section.

Leave a Reply

Your email address will not be published. Required fields are marked *