Tracking PayPal with Google Analytics

Tracking PayPal with Google Analytics and Google AdWords

UPDATE: Read our new post on tracking PayPal with Google Analytics that gives you more accurate data in your reports.

Setting up ecommerce tracking is essential if you are selling online (and even if you don’t sell online you should still be aiming to measure the value of particular conversions, interactions and engagement on your site). But not all ecommerce systems integrate with Google Analytics. If you are selling online chances are you accept PayPal as a method of payment. So how do you measure people who have purchased using PayPal?

First step, create a thank you page for successful PayPal transactions and set that URL within PayPal so visitors are returned to your site.

google-analytics-paypal

The problem is that when the visitor returns to your site after payment has been received (or cancelled) PayPal gets the credit for the conversion and not the original way the visitor found your site.

Steps For Tracking PayPal With Google Analytics:

1. Log into PayPal.

2. Under the ‘My Account’ tab click on the ‘Profile’ link. (If you are using the new version of PayPal then head to ‘My Profile’ and select ‘My Selling Tools. If you are logged in, then use this link to get there, it’s hard to find otherwise.)

3. Click on ‘Website Payment Preferences’ under ‘Selling Preferences’ in the right column. (If you are on the new version of PayPal, then look for ‘Website Preferences’.)

4. Turn ‘Auto Return’ on and enter the URL of your PayPal thank you page.

Then add ?utm_nooverride=1 to the end of your URL (highlighted in blue below), this will ensure that transactions (i.e. conversions) are credited to the original traffic source, rather than PayPal.

Using Universal Analytics? Then you do not need to add ?utm_nooverride=1, instead simply add paypal.com to your ‘Referral Exclusion List’ (within the Admin section, under ‘Property’ and ‘Tracking Info’).

paypal-return-url

For example, if a visitor came from a Google search for ‘gardening book’ the conversion will be credited to Google, organic, gardening book (and not PayPal).

At this point if you simply want to track the conversions using goals you can setup a new goal for the thank you page within Google Analytics. However, if you want to also get Google Analytics ecommerce tracking up and running you will need to get a little more technical.

PayPal’s payment data transfer allows you to receive transaction details once a visitor is back on your site (visit the PayPal technical overview article for details).

Getting Advanced With Ecommerce Tracking:

6. Turn ‘Payment Data Transfer’ on.

paypal-payment-data-transfer

Please note that once you turn on ‘Payment Data Transfer’ it will be applied to all Auto Return payments unless otherwise specified within the button or link for that Website Payment.

7. You will now either have to create your ‘Buy Now’ buttons or modify your existing buttons.

If you are creating new ‘Buy Now’ buttons leave the return URL blank (or if you specify a different URL ensure it has ?utm_nooverride=1 at the end. See the note above if you are using Universal Analytics.).

If you already have buttons on your site you will need to look for the following code:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
...
</form>

And add the following before the element (with your correct thank you page URL):

<input type="hidden" name="return" value="http://www.site.com/paypal-thanks.php?utm_nooverride=1">

(Again, if you are using Universal Analytics you do not need to add ?utm_nooverride=1 to the end of the URL.)

8. Finally you will need to modify your thank you page to grab the PayPal data being transfered using either the POST of GET methods (you will have to talk to your web developer or IT person if you are not familiar with the coding of your site). Basically, you will need the Google Analytics ecommerce tracking code to automatically (or dynamically) grab the correct values and place them in the code. You will be able to get total price, tax, shipping, transaction id, item name, quantity, etc.

The following example uses the Asynchronous Tracking Code (and not legacy code and not Universal Analytics code).

Example Google Analytics Ecommerce Tracking Code:

_gaq.push(['_addTrans',
    '1234',           // transaction ID - required
    'Acme Clothing',  // affiliation or store name
    '11.99',          // total - required
    '1.29',           // tax
    '5',              // shipping
    'San Jose',       // city
    'California',     // state or province
    'USA'             // country
  ]);
  _gaq.push(['_addItem',
    '1234',           // transaction ID - required
    'DD44',           // SKU/code - required
    'T-Shirt',        // product name
    'Green Medium',   // category or variation
    '11.99',          // unit price - required
    '1'               // quantity - required
  ]);
  _gaq.push(['_trackTrans']);

Learn about Google Analytics ecommerce tracking

For Google AdWords conversion tracking you simply need to grab the total value and pass that into the conversion script as the value.

Example Google AdWords Conversion Tracking Code:

 var google_conversion_id = 1234567890;
 var google_conversion_language = "en_AU";
 var google_conversion_format = "1";
 var google_conversion_color = "666666";
 var google_conversion_label = "Purchase";
 if (10.0) {
 var google_conversion_value = $10.00

Learn about Google AdWords conversion tracking

Finally, we strongly recommend that you test everything out using the PayPal Sandbox.

If you have any questions please feel free to contact us directly and if you are located in Australia check out Loves Data Training for the best Google Analytics training available!

Thanks to ROI Revolution for inspiring this post who originally discussed Google Analytics and PayPal back in 2007.



  • http://www.blogger.com/profile/05758416699993132791 Omar Ead

    GREAT article! Thats all i can say…

  • http://www.blogger.com/profile/03844355399848467649 Jeremy

    Wonderful! Thank you for posting this.

  • Anonymous

    Can you use this information for “add to cart” buttons or simply “buy now” buttons?

    Rick

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Hi Rick,

    Thanks for the question.

    It shouldn’t be a problem. Try adding the code to your “add to cart” button.

    If you have any problems feel free to get in touch (http://www.mangoldsengers.com/contact-us).

    Regards,
    Benjamin Mangold

  • Anonymous

    The e-commerce tracking code is working fine, however all the data comes as referrer (Paypal). Is there a way where i can actually track and separate paid and non paid data or organic and non organic data. Any help would be grateful.

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Hi Anonymous,

    It sounds like you haven’t added ?utm_nooverride=1 to the end of your thank you page URL.

    Ensure you have completed step 7 in the post.

    Regards,
    Benjamin Mangold

  • Anonymous

    Hi Benjamin,

    Thanks for the quick response.

    In the form variable do we need to include the return URL as we have mentioned it in the paypal account settings which is in the following format – http://www.yoursite.com/thankyou.html?utm_nooverride=1.

    Will this help us to get traffic data i.e. direct or organic or paid and not only as referral traffic.

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    I believe that should do the trick.

    basically adding ?utm_nooverride=1 will ensure the credit for the conversion goes to the original source/medium for the visitor (rather than being overwritten by PayPal as a referral).

    Let me know how you go!

    Regards,
    Benjamin

    • Anonymous

      Hi Benjamin,
      We’re having trouble tracking all of our sales.
      When the payer has a paypal account, the auto return will work and the sale will be registered.
      However, when the payer pays by credit card, the payment goes through paypal but the sale will be registered only if the payer hits the button “back to merchant site” which they never do.
      Paypal has confirmed that auto return will work only with paypal user’s.
      Do you know what we can do to track all our sales?

  • http://www.blogger.com/profile/10315888966228024365 Mydogtag.ca

    What if the customer closes how browser before he is redirected back to my site?

  • Anonymous

    Hi Benjamin,

    We have implemented all the steps as per the recommendations made by you. However we are still getting data as referral traffic. Is it because the entire checkout process has “https” URLs while the rest of the site has http URLs. Is this the reason why E-commerce is not working properly. Can you please provide us an alternate solution so that proper data is tracked and not only as referral traffic.

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Hi Mydogtag.ca,

    If a visitor closes their browser (or does not make it to the thank you page on your site) then the conversion will not be reported in Google Analytics.

    There is really only one other choice in this scenario and that is track the conversion on the outbound click to PayPal.

    The downside of this is that your conversions will be inflated.

    Thanks for the question!

    Regards,
    Benjamin

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Hi Anonymous,

    Regarding referral traffic problem – it is difficult to guess at what the cause of this is. Could you give us an example of a page where you have implemented the solution.

    If you don’t want to share this in these comments you can complete our contact form at http://www.mangoldsengers.com/contact-us – just ensure you mention that you have posted in the comments of this post.

    Regards,
    Benjamin

  • Laura Kornish

    Benjamin,
    Does the auto return from PayPal back to the site only work for buyers who have an actual PayPal account (and not for buyers who enter a credit card into PayPal)?

    I saw that explanation at http://www.google.com/support/forum/p/AdWords/thread?tid=433e0ebab1c6bd9d&hl=en
    (SosieBear’s post on 5/6/10).

    Regards,
    Laura

  • http://www.blogger.com/profile/03770861924691349127 Jerry

    We use only Paypal buy now buttons.

    The problem that I’m having is that Paypal only Auto-Returns if the customer has a paypal account. If they simply choose to use a credit card and NOT become a Paypal member, Paypal will not auto-return them to our final thank you page. Therefore we can’t always track conversions.

    Considering we only care about tracking conversion in Adwords, will your method work for our scenario?

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    According to PayPal’s own documentation on auto return;

    “Auto Return applies to all PayPal Website Payments, including Buy Now, Donations, Subscriptions, and Shopping Cart.”

    I will see if I can find any more details and post another comment.

    Thanks,
    Benjamin

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Okay, so if someone pays with a credit card and does not have a PayPal account then they are not automatically redirected to your thank you page. Apparently they have to click a link to return to the website.

    I haven’t been able to find this officially noted by PayPal, it only appears on a few forum posts from users who say it is some type of legal requirement that PayPal must stick to.

    Also check to ensure you are using Website Payments Standard – apparently auto return only works with this type of payment.

    Possible solutions/compromises:

    (1) Prevent payments via credit card (probably not a great idea because we all want to be paid in the quickest, easiest manner).

    (2) Tell people to click ‘return to merchant’ if they pay with a credit card (this could be placed on the last step before they get sent to PayPal).

    (3) Create a backup goal that logs the outbound click to PayPal (be prepared for inflated goal conversions).

    (4) Tell PayPal they should update their documentation and that they should allow auto return on credit card payments!

    And for the more technical…

    (5) Use IPN (Instant Payment Notification) to trigger an email to get people to the thank you page or somehow trigger the goal conversion.

    The last one is not something I have personally played with, but should be technically possible. I might get our team to have a look at this and see what is possible.

    I hope that gives you a few ideas – if you think of any more please let me know or post them.

  • Nick

    Hello Benjamin,

    thanks for the very clear instructions.

    Question n°1:

    Will the Google Analytics ecommere tracking code work with a hosted buy now button (hosted on Paypal)?

    I’m using product specific buy now buttons hosted on Paypal and product specific thank you pages on unique urls.

    Using Paypal hosted buttons means the next piece of code is ABSENT in my button’s code (the code on my pages) : input name=”return” type=”hidden” value=”http://www.site.com/paypal-thanks.php?utm_nooverride=1″ />

    Is adding ?utm_nooverride=1 at the end of the return urls, inside the Paypal configuration panel for buy buttons a solution? Which means that the return url “http://www.site.com/paypal-thanks.php?utm_nooverride=1″ will also be hosted on paypal.

    Question n° 2:

    Quote: 8. Finally you will need to modify your thank you page to grab the PayPal data being transfered using either the POST of GET methods (you will have to talk to your web developer or IT person if you are not familiar with the coding of your site).

    Basically, you will need the Google Analytics ecommerce tracking code to automatically (or dynamically) grab the correct values and place them in the code. You will be able to get total price, tax, shipping, transaction id, item name, quantity, etc.

    What do you mean? Isn’t adding the analytics ecommerce tracking code on the thank you page enough?

    Thank you in advance,

    Nick

  • Nick

    Hello Benjamin,

    I posted a comment on august 27. Can you check it, please. I’m still very interested in your answer.

    Sorry for pushing you…

    Nick

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Hi Nick,

    Regarding your questions…

    (1) I haven’t used buttons hosted on PayPal, so I would strongly recommend testing the solution out. Try creating a new button (just for testing) and add the parameter to your destination page URL.

    In theory it should work correctly because if someone comes to your site, clicks the button (which is hosted), gets taken to PayPal and then returns to your site with the parameter added to the end of the URL – they will keep their original source/medium and it won’t be overwritten as a referral from PayPal.

    In order to test this, create a hidden page (i.e. not public) with the hosted test button. Then visit your site with some fake campaign tags (e.g. http://www.site.com?utm_campaign=TEST&utm_source=TEST&utm_medium=TEST) this will set a cookie with the ‘TEST’ values. Click on to PayPal and complete a test transaction and then when you return to your site you should check your cookies and they should still have the ‘TEST’ values.

    (2) The Google Anlaytics ecommerce code needs to contain the correct values for the particular transaction, so if someone purchases 10 mugs with a total value of $100 those details need to be within the tracking code.

    This is something your web developer will have to help you with because it requires programming. That being said, it should not take your web developer long to get this done.

    I hope that helps! (And thanks for reminding me to comment!)

    Regards,
    Benjamin

  • Anonymous

    Thanks for this valuable article, but iam confused because i have 2 different sites on my paypal account which all together are different products with different costs and goal value.
    So my question is how would i make 2 thankyou pages because in paypal it suggest only one URL in auto return therefore i can only setup one eCommerce tracking code on thank you page. Adding both goal values in same tracking thankyou page is iam sure not suggested by any means.
    Thanks! Vincent

  • Anonymous

    Hi just wondering if you also have sample of paypal and analytics integration using c#. Thanks.

  • Hemi

    Hello Benjamin,

    We are promoting an ebay store via Google adwords. We want to track ebay store conversions via adwords. Is this possible?

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    Hi Vincent,

    Unless PayPal has added the ability to add multiple thank you pages (which I am guessing they haven’t). Then your options would be to create a separate PayPal account for the separate website, only track one or you could fire off a conversion into two Google Analytics accounts on the thank you page. But this option isn’t a good one because you will have double the number of conversion spread across the two Google Analytics accounts.

    So creating a separate PayPal account is probably the best option.

  • http://www.blogger.com/profile/10418367156722243152 Benjamin Mangold

    @Anonymous Unfortunately we don’t have a c# integration we can share with you.

    @Hemi Once you have conversions tracking into Google Analytics you can then either import that data into Google AdWords. But the simplest option would be to just place the Google AdWords conversion script onto the thank you page. This will give you the total number of conversions. Tracking value has the same issues as described in the post and comments above.

  • Sharon

    Hi Benjamin,

    Thanks for all your hard work.

    I notice there seems to be two places to add the returning URLs and I wonder if one overides the other. In Selling preferences as you say, you can enter the returning thank you page and added code, but when you create a button for a product, there is also a “customise advanced Features” drop down before you are given the html button code. Here you can once again give a returning URL. Does this overide the other one if completed? We have created a different return landing page for every product to match the returning url created in the button. Did I waste my time, could I have used the overide code and just had one returing thank you page? This is getting way above my head!!! Sharon

  • http://www.blogger.com/profile/03182107193665533888 rgsamways

    I’m not sure I understand step 8. I think it means I will need to either hardcode values into the script, or somehow pull them from a querystring or post. Could someone elaborate please?

    Thanks..

  • http://www.blogger.com/profile/04301172208891290251 James

    The only part I am unsure about is the Google Analytics Ecommerce Tracking Code.
    I am not sure how to add this to the page. I understand I add the code to the page but every example shows data included. Do I just remove the parts like price etc as I have many different products on the website. I know there is probably a really straight forward answer but just cant get my head round it.

  • http://www.greenpathtransfers.com/ Adrian

    rgsamways and James, you’d need to find out what the variable names are that are passed onto the thank-you page (or whatever page you’ve got the tracking code on), and then add them to the ecommerce tracking code.

    Eg:

    pageTracker._addTrans( “1234″, // Order ID”Sea View”, // Affiliation

    “$total″, // Total

    “$tax″, // Tax

    The above would work if the variable name for the total cost was $total, for example.

    With that said, I don’t know what variable names Paypal uses – perhaps someone else could share that information?

  • http://www.greenpathtransfers.com/ Adrian
  • http://darrylmanco.com/ Darryl M

    Thanks for this post. I was looking for an example and bingo. Can’t wait to implement. Cheers!

  • http://downtownecommerce.com/ Downtown Ecommerce

    So we have a client that check outs and goes to PayPal and then the return url goes to a Return URL that is defined realtime in Script. What should i do to input the ?utm_nooverride=1 and the return URL? Thank you

  • Claire

    Hi, Thanks for this useful post. Our Google Analytics doesn’t track around 30% of our Paypal transactions at the moment. We don’t allow payment by card and buyers are being redirected to our thank you page. The numbers not being tracked seem too high to just be customers who are closing their browser too early. Have you ever come across this before? Do you have any advice?

  • http://www.blogger.com/profile/07804946556587856416 Damien Elsing

    Thanks Ben, I’m a little confused with steps 7 and 8. I’m on a wordpress site using a third party shopping cart system.

    1. I’ve added the extension to the URL in Paypal preferences – do I now need to add the extension to the URL on the thank you page as well?

    2. If not using paypal’s buy now buttons but custom ones, do you still need to edit the buttons in any way?

    3. i want to track conversions in both adwords and analytics. Is the updated tracking code dependent on the “payment data transfer” being turned on in Paypal? i don’t see what the point of that is, and not sure how to turn it on in wordpress.

    Thanks for the great article.

  • http://ktomasso.wordpress.com/ ktomasso

    I am having a very similar problem, and wondering if the ?no_override=1 trick will fix it. In our funnel the order is as follows:

    (1) Sales Page > (2) Payment Type > (3) Process Info > (4) Thank You

    If the user selects PayPal in step 2, they leave our site to go to paypal, and then are redirected back to step 3 to confirm. Using the ?utm_nooverride=1, should this put users back in the funnel as if they had simply passed through from step 2 to step 3 directly?

    Our funnel shows a very high exit rate at step 2, and we need to figure out if this is due to paypal, or another issue that we must fix. Anyone’s help is much appreciated!

    • http://www.blogger.com/profile/14593656358376419422 Nick Harris

      I’ve got the same exact question. Did you have any luck sorting this out? Anyone else?

  • Anonymous

    Hello, thanks for the article.

    The issue I am experiencing is that auto redirect to my success (thankyouforyourorder page) takes minimum of 10 seconds and some customers close paypal confimation page before being redirected back to my site, thus I cannot track anything and create discrepancy.

    Any thoughts please?

  • Doru

    Hi,

    We are in 2013 (3 years after the initial post). Does anybody know if this is still the case? – “Okay, so if someone pays with a credit card and does not have a PayPal account then they are not automatically redirected to your thank you page.”

    If yes, what are the alternatives for doing a reliable PayPal & GA Analytics e-commerce integration? I am using ‘Paypal Websites Payment Pro’.

    Thanks,
    Doru

  • Benjamin Mangold

    You really only have two options because PayPal doesn’t allow you to place code on their site:

    1) Measure a conversion on the outbound click
    2) Measure a conversion when people return to your site

    As you have mentioned, you will be missing some people if you go with option 2 and going with option 1 will lead to inflated numbers.

  • Benjamin Mangold

    Hi Doru,

    PayPal does appear to still have a 10 second delay on the redirect, so I would still want to consider this when setting up tracking.

    If you are using Universal Analytics (the latest version of the Google Analytics Tracking Code), then you don’t need to use the ?utm_nooverride=1 as mentioned in the post. Instead you can set PayPal on your ‘Referral Exclusion List’.

    • Lolo

      Hi, i did a test but there wasn’t a 10 second delay for the redirect (but just a link saying that the buyer could comeback to my website).

      That’s normal ?

      thanks

      • Benjamin Mangold

        Hi Lolo, yes this is normal and simply how PayPal behaves.

  • Benjamin Mangold

    Hi Nick,

    I’ve answered some of the questions below, so I hope that helps you. (Apologies for the long delay, we switched our commenting system and the comments on older posts didn’t get flagged in the new system.)

  • Edward Newmen

    nice and easy way to keep track of paypal transactions.. but the data just doesn’t help as much. i mean its ok that we see some transaction related info, but it really is very minimalistic when we have high volume transactions. is there a better way to track paypal transactions?

  • Benjamin Mangold

    Stay tuned for an updated post that shows you how to measure into Google Analytics much, much more reliably using Universal Analytics and also include ecommerce data in your reports!

  • Brian

    Can anyone recommend how I add Step 8 to Woocommerce on WP?

  • ninagreaves

    Thanks Benjamin I’m looking forward to this. Many thanks Nina

  • ras

    Regarding your “If you are using Universal Analytics (the latest version of the Google Analytics Tracking Code), then you don’t need to use the ?utm_nooverride=1 as mentioned in the post. Instead you can set PayPal on your ‘Referral Exclusion List’.

    Does this affect conversions for other referrals? For example, If GA shows that we have 100 referrals( of which all them probably came from another source – but the sake of this example, let’s assume they all came from “Organic Search traffic”) from PayPal and 50 of them converted, and then we added PayPal to the “Referral Exclusion List”, does the 50 conversions fall back to the original referrer “Organic Search Traffic”? Or do those 100 referrals and 50 conversions just not get accounted for?

    • Benjamin Mangold

      Thanks for the question!

      The referral exclusion list is designed to work like utm_nooveride, so if you have 50 users who go from a Google organic search to your website, then to PayPal and then back to your website’s thank you page all of those 50 people will be seen as coming from the Google organic search. If you don’t use the referral exclusion list or utm_nooveride then the 50 people will be seen as coming from PayPal.

      So to answer your question, you won’t be missing any conversions, they will simply be attributed to the original method of finding the website. In our example above that is Google organic search.

      Does that make sense?

  • Benjamin Mangold

    Check out our new post that walks though how to measure PayPal transactions more accurately with Universal Analytics at http://www.lovesdata.com/blog/2014/paypal-google-analytics/

  • Benjamin Mangold

    Hi @disqus_fW6at1cu1p:disqus, thanks for the question. You might want to read our new post that allows you to accurately measure PayPal transactions with Google Analytics. It uses a different approach that uses a tighter PayPal integration. You can read about it at http://www.lovesdata.com/blog/2014/paypal-google-analytics/

  • Christian Kriebel

    Thanks a lot for this post. Helped me saving time to correctly setup my online shop http://everfood.ch

  • Jan Bob Swart

    thanks mate. I will try this on my pandora jewelry site at http://www.pandorakiss.com