The ROI Revolution Blog
Tracking PayPal Transactions in Google Analytics
February 13, 2007
We’ve had a lot of people enrolled in our Google Analytics Quick-Start Courses asking about PayPal. We’ve helped a few of our clients track PayPal e-commerce within Google Analytics, thanks to the Payment Data Transfer function and a bit of scripting on the back-end.
First things first, you’ll need to enable Payment Data Transfer (PDT) in your PayPal account. This allows you to transfer payment details (the item purchased, the transaction amount, geographical location of buyer, etc.) to your own website domain.
I’ve found that enabling PDT is a bit of a pain, not because it’s difficult but because it’s hard to find the option in PayPal’s interface. Immediately after logging into PayPal, click the Merchant Services tab. On the right of the screen is a list of Key Features for the PayPal Website Payments Standard. Click the ‘View All Features’ link.
Under Backend Integration, toward the bottom of the page, you’ll see the Payment Data Transfer information. Select ‘Set It Up’.
Here, read through the information and enable Auto-Return and PDT. Follow the instructions to get this working for your PayPal account. You’ll need to create a hidden landing page on your site that collects the Payment Data (PayPal offers examples for ASP/VBScript, Cold Fusion, PERL and PHP). We’ll come back to that in just a bit, though.
Next, create your Buy Now buttons as normal. Again, ensure that PDT is enabled for this button and ensure that you have the correct landing page set.
Okay, to review, we currently have PDT enabled for our PayPal account, we have a hidden landing page that collects and stores Payment Data, and we have a Buy It Now button that initiates the whole procedure.
Now, we’re at the receipt page. What do we do? Well, you’ll probably want to provide your visitor with a printable receipt, filling in the data with the variables that you passed from PDT and the landing page. Unlike the landing page, your receipt page is tagged with the Google Analytics script.
You’re also going to want to include the hidden Google Analytics e-commerce form, populated with the very same data as in your printable receipt. And you’ll need to call the __utmSetTrans function after this hidden form.
To summarize, here’s what happens when a visitor from AdWords hits your site and makes a purchase:
- Enters your site from Google AdWords campaign x, keyword y, etc.
- Clicks your Buy Now button and leaves your site.
- Fills out the order form at PayPal and submits payment info.
- Returns to your hidden landing page with Payment Data provided by PDT, where they are not tracked by Google Analytics, as there is no script on this page.
- Redirects (immediately) to the receipt page, along with the utm_nooverride parameter, telling Google Analytics not to override their initial referral information.
- Views printable receipt while their hidden Google Analytics e-commerce form is populated and then sent off for processing by the __utmSetTrans function.
It’s a straightforward procedure that involves a little scripting knowledge, but can be set up in an hour or two. It’s certainly a hack, for all the reasons mentioned above, but for what it’s worth, it’s a quick and easy way to get PayPal transactions into Google Analytics.
If this whole procedure is over your head, don’t fret. We’ve done it many times and we’d love to get your PayPal transactions tracking in Google Analytics. Just contact us about one of the many Google Analytics supports plans that we have available.