Tracking true referrals in Google Analytics when using PayPal and other payment gateways

Many businesses use PayPal and other third party payment gateways to accept online payment.

But this can create tracking issues in Google Analytics.

A payment gateway is a service through which you can accept credit/debit cards and other forms of electronic payments on your website. PayPal is an example of payment gateway.

Whenever a customer leaves your website to make payment via a third party payment gateway and later return to your website from the gateway website, Google Analytics often attribute sales to the payment gateway instead to the original traffic source.

This is quite common in case of PayPal.

You can often find appearing as a top referrer in Google Analytics Referral report:

paypal top referrer

Following are the methods through which you can minimize self referral issues while using payment gateways.

I used the word ‘minimize’ because often it is not possible to completely eliminate such tracking issues.

#1 Use a Custom Shopping Cart and Custom Payment Gateway

The best way to minimize self referral issues while using payment gateway is, not to use any third party payment gateway to accept online payments.

You should seriously consider using a custom shopping cart and custom payment gateway that are developed specially to meet your business needs.

There are many advantages of using custom made shopping cart but the one which are worth highlighting are:

#1 Your customers will never leave your website to make payment and there will be little to no self referral issues.

#2 You no longer need to depend on any third party shopping carts and/or payment gateway or wait for updates/fixes for the foreseeable future.

It would be a one time cost for you to develop your own shopping cart but will be cheaper for your business in the long run.

Get the E-book (52 Pages)

Get the E-Book (37 Pages)

#2 Use a Direct Payment Gateway

The best way to track original referrals while using third party payment gateways is not to use external payment gateways.

There are two types of payment gateways:

#1 External Payment Gateways

#2 Direct Payment Gateways

If you are using external payment gateway, then your customers must leave your website to complete transaction.

But if you use direct payment gateways, then your customers can complete transaction without leaving your website.

Following are the examples of external Payment gateways:

  1. PayPal Express Checkout
  2. PayPal Payflow Link
  3. PayPal Payments Advanced
  4. DirectPay

Following are the examples of direct Payment gateways:

  1. PayPal Payflow Pro
  2. PayPal Payments Pro
  3. WorldPay (Direct)
  5. Shopify Payments

Consider using only direct payment gateway.

It will cost you more than external gateway but help you in minimising self referral issues and most importantly help you from not loosing transactions data in Google Analytics.

#3 Provide Several Payment Options to Users

Don’t just rely on services like PayPal to accept online payments.

Use other payment options like: wire transfer, payment upon pick-up, pay by phone etc.

There are many businesses which just rely on services like PayPal for accepting all of their online payments and they are the one which hit the hardest from PayPal self referral issues in Google Analytics.

#4 Add to the Referral Exclusion List

But don’t do it in a hope that this will fix your PayPal referral issues and you will start tracking true referrals in Google Analytics when using PayPal.

Adding to the referral exclusion list will not help you track the original referrer.

paypal referral exclusion list

Exclude PayPal so that when a user return to your website from PayPal after making payment, a new GA session is not triggered.

If you don’t exclude PayPal from being treated as referral traffic source then whenever a user return to your website from PayPal, a new GA session will start (provided you are using universal analytics and not classic Google Analytics) and this will inflate and skew your session / traffic data.

I often hear from clients that referral exclusion list doesn’t work.

It does work in a way that it greatly reduce self referral issues.

However this is also true that often referral exclusion list does not completely eliminate the excluded domain(s) from appearing in the referral traffic report.

The other thing to keep in mind is that referral exclusion does not work retroactively. 

So any visit/sales attributed to PayPal before adding to the referral exclusion list will still be attributed to PayPal in GA reports.

Therefore you need to make sure that once you have added a domain to the referral exclusion list, you look at the referral report from the time period when you first implemented referral exclusion.

#5 Add Event Tracking Code to the PayPal ‘Buy Now’ Button

PayPal provides you button code through which you can embed PayPal ‘buy now’ button on your website:

paypal buy now button

You can edit this button code and place following event tracking code (highlighted in bold):

<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.”>

What this event tracking code will do is that whenever someone clicks on your PayPal button, it will record the button click and send the click data to Google Analytics.

Then later through event tracking report you can determine the original traffic source by applying ‘source/medium’ as secondary dimension:

paypal event trackingObviously this is not a foolproof method.

Whether a user complete the purchase or not after clicking on the PayPal ‘buy now’ button, the click event will always be recorded.

But you can at least get a good idea of where majority of these PayPal transactions originally came from.

Bonus Tip: Enable ‘Auto Return’ and PDT in your PayPal Account

While this tip will not fix your Paypal self referral issues, it will help you greatly in minimizing lost PayPal transactions data in Google Analytics.

One of the side effects of using an external payment gateway (which many marketers don’t seem to be aware of) is that there is always a strong possibility that you are not getting all of transaction data in your Google Analytics reports.

To get all of the transaction data from a third party payment gateway, you need to make sure that your customers always return back to your website and visit the order confirmation page.

Your order confirmation page contains the ecommerce tracking code which send the transaction data back to Google Analytics.

If a customer close the browser window after viewing the receipt page of a third party payment gateway and do not return to your website then no ecommerce tracking code will be executed and no transaction data will be sent to Google Analytics.

You can not pass Google Analytics client ID to PayPal, as PayPal does not allow you to add the Google Analytics tracking code to its page through which it can accept client ID from your website.

So cross domain tracking is not going to work here.

You need to wait for a user to return to your website from PayPal and let him visit the order confirmation page before the PayPal transaction data can be sent to Google Analytics server.

Many times users close the PayPal receipt page and do not return to your website.

In that case PayPal transaction data is not able to pass to GA server.

You can greatly increase the likelihood of people returning to your website after completing the transaction by enabling ‘auto return’ and by specifying ‘Return URL’ in your PayPal account.

Follow the steps below to enable auto return in your PayPal account:

Step-1: Login to your PayPal account and then click on the ‘Profile and settings’ link as shown below:

profile and settings

Note: I use PayPal business account, so the ‘profile’ link may be located at different place in your account if you don’t use PayPal business.

Step-2: Click on ‘My Selling Preferences’ link as shown below:

my selling preferences

Step-3: Locate ‘Website Preferences’ section and then click on the ‘update’ button next to it:

website preferences

Step-4: Set auto return for website payment to ‘on’ and then enter the return URL as shown below:

auto return for website paymentsNote: Auto return option is disabled by default.

When your turn on the ‘auto return’ setting, all users are automatically redirected back to your website once the payment has been made.

Step-5: Enable PayPal PDT . This setting is below the ‘Return URL’ text box:

paypal pdt

Through PayPal PDT (Payment data transfer) you can transfer PayPal transaction details to your GA reports via your website ecommerce tracking code.

Other Articles on Specialised Tracking in Google Analytics

  1. Google Analytics Recurring Revenue and Subscriptions Tracking Guide
  2. How to track the impact of cookie consent on website traffic in Google Analytics
  3. Phone Call Tracking in Google Analytics and Beyond
  4. Scroll Tracking via Scroll Depth Trigger in Google Tag Manager
  5. Video Tracking via YouTube Video Trigger In Google Tag Manager
  6. Calculated Metrics in Google Analytics – Complete Guide
  7. The one thing that you don’t know about and the referral exclusion list
  8. Introduction to Postbacks in Google Analytics
  9. Creating Content Group in Google Analytics via tracking code using gtag.js
  10. Tracking Site Search without Query Parameter in Google Tag Manager
  11. Setting Up Site Search Tracking for POST based search engines in Google Analytics
  12. Tracking Site Search for GET-Based Search Engines in Google Analytics
  13. Understanding site search tracking in Google Analytics
  14. Tracking Virtual Pageviews in Google Tag Manager – Complete Guide
  15. Creating and using Site Search Funnel in Google Analytics
  16. Learn to Setup Facebook Pixel Tracking via Google Tag Manager
  17. How to use Keyword Hero to reveal Not Provided keywords in Google Analytics
  18. Guide to Event Tracking via Google Tag Manager
  19. Learn to track Qualified and Won leads in Google Analytics
  20. Creating your own Google Analytics Tag Auditing System
  21. Using multiple Google Analytics tracking codes on web pages
  22. Guide to Offline Conversion Tracking in Google Analytics
  23. Google Analytics and YouTube Integration Guide
  24. Complete Guide to Google Analytics for Facebook
  25. Tracking true referrals in Google Analytics when using PayPal and other payment gateways
  26. Virtual pageviews in Google Analytics – Complete Guide
  27. YouTube Video tracking via Google Tag Manager
  28. Implementing E-Commerce Tracking via Google Tag Manager
  29. Event Tracking in Google Analytics – Complete Guide
  30. E-Commerce Tracking in Google Analytics – Complete Guide
  31. Google Analytics Cross Domain Tracking Explained Like Never Before
  32. Google Analytics Social Tracking – Twitter, Facebook, Google Plus and LinkedIn
  33. Setting up & Tracking AMP Pages in Google Analytics
  34. Setting up Sales Funnel across websites in Google Analytics
  35. Using Data Visualization to analyze the SEO Performance
  36. Tracking offline conversions in Google Adwords
  37. How to Correctly Measure Conversion Date & Time in Google Analytics
  38. Tracking Twitter and Linkedin Social Interactions in Google Analytics
  39. Implementing Scroll Tracking via Google Tag Manager
  40. Phone Call Tracking and ROI calculations – Champion’s Guide
  41. Google Analytics Cross Domain Tracking (ga.js)
  42. Open Graph Protocol for Facebook Explained with Examples
  43. How to Exclude URL Query Parameters in Google Analytics?
  44. Understanding Google Analytics Default Page Setting
  45. Implementing rollup reporting in Google Analytics

How to use Digital Analytics to generate floods of new sales and customers.

(Even if you are completely new to Digital Analytics)

What You’ll Learn On This FREE Web Class!

#1 The number 1 reason why most marketers and business owners are not able to scale their advertising and maximise sales. 

#2 Why you won’t get any competitive advantage in the marketplace just by knowing Google Analytics. 

#3 The number 1 reason why conversion optimization is not working for your business. 

#4 How to advertise on any marketing platform for FREE with an unlimited budget.

#5 How to learn and master digital analytics in record time.


My best selling books on Digital Analytics and Conversion Optimization

Maths and Stats for Web Analytics and Conversion Optimization
This expert guide will teach you how to leverage the knowledge of maths and statistics in order to accurately interpret data and take actions, which can quickly improve the bottom-line of your online business.

Master the Essentials of Email Marketing Analytics
This book focuses solely on the ‘analytics’ that power your email marketing optimization program and will help you dramatically reduce your cost per acquisition and increase marketing ROI by tracking the performance of the various KPIs and metrics used for email marketing.

Attribution Modelling in Google Analytics and Beyond
Attribution modelling is the process of determining the most effective marketing channels for investment. This book has been written to help you implement attribution modelling. It will teach you how to leverage the knowledge of attribution modelling in order to allocate marketing budget and understand buying behaviour.

Attribution Modelling in Google Ads and Facebook
This book has been written to help you implement attribution modelling in Google Ads (Google AdWords) and Facebook. It will teach you, how to leverage the knowledge of attribution modelling in order to understand the customer purchasing journey and determine the most effective marketing channels for investment.

Himanshu Sharma

Digital Marketing Consultant and Founder of

Himanshu helps business owners and marketing professionals in generating more sales and ROI by fixing their website tracking issues, helping them understand their true customers purchase journey and helping them determine the most effective marketing channels for investment.

He has over 12 years experience in digital analytics and digital marketing.

He was nominated for the Digital Analytics Association's Awards for Excellence.

The Digital Analytics Association is a world renowned not-for-profit association which helps organisations overcome the challenges of data acquisition and application.

He is the author of four best-selling books on analytics and conversion optimization:

error: Alert: Content is protected !!