How To Track Referrer With PayPal in WooCommerce

 In WooCommerce

I recently discovered that when using PayPal with WooCommerce, Google Analytics shows all transactions as coming from PayPal instead of the actual traffic source. This makes it very difficult to track the performance of an online shop in terms of ad campaigns, social marketing, and general sources of revenue. But fear not. After some research I have found there is a simple solution to properly track referrer with PayPal in WooCommerce.

Note that this guide makes some assumptions. First, you’re using PayPal standard checkout with your WooCommerce shop, and your PayPal account must be a business account. Second, you must be setup to be send and accept enhanced e-commerce data with your site. I use a plugin to send enhanced e-commerce data on all my sites. And make sure you’ve followed these instructions to ensure Google Analytics is ready to receive the events.

Why Doesn’t It Work?

The underlying problem is specifically with gateways that take your customer off your site to complete transactions. While this is great for security, it wreaks havoc on referrers. This is because the page view that counts as the transaction being complete occurs when the visitor transfers back from PayPal to your confirmation screen. Google Analytics does not tie this page back to the visitor’s original session, and so it looks like another referrer source.

WooCommerce PayPal Referr

Order confirmation events showing a PayPal referrer.

How To Track Referrer With PayPal in WooCommerce

Tracking visitor referrer with PayPal in WooCommerce is simple to setup, but you will need access to the PayPal admin. Most of my clients prefer to control their own PayPal login (and frankly, I prefer to not have access to their payment gateway backends) so I usually send them these PayPal steps. For the most part even non-technical users can manage the changes easily. If your client is having issues or is not comfortable making the changes, consider a screen share to help guide them.

PayPal Setup

To get started, let’s get PayPal configured first. Login to your PayPal business account and click Profile and Settings.

Next click the My selling tools menu:

From there, click the Website preferences menu:

Now you’re ready to configure PayPal to send proper referrer to WooCommerce. There are several settings you need to set:

  • Set Auto Return to On. This ensures the visitor is automatically redirected back to your shop after they make payment, instead of relying on them to click a link to go back.
  • Set Return URL to https://www.domain.com/checkout/order-received/?utm_nooverride=1. Obviously you should substitute your actual domain (paying attention to whether or not your site uses www), and make sure https is enabled on your site (or change the URL to use http, but if you’re running an e-commerce store you hopefully have https enabled). The utm_nooverride is the key to ensuring PayPal sends back proper referrer information so Google Analytics doesn’t think it’s a new visitor coming from PayPal.
  • Set Payment Data Transfer to On. This sends back additional payment information to your confirmation page.

That’s it for PayPal setup! It looks like a lot, but it really only takes a couple of minutes. The Return URL is the most important thing, so make sure you double check it if you’re still not seeing the right referrer get set from PayPal orders. Assuming you set it up properly, your order confirmation should start showing proper referrer:

Order confirmations showing proper referrer.

Recent Posts
WooCommerce AJAX Variations LimitMultiple WooCommerce free shipping rules
Verified by ExactMetrics