Tracking PayPal with Google Analytics and Google AdWords

Setting up ecommerce tracking is essential if you are selling online (if you don't sell online check out Monetizing Non-Ecommerce Sites). But not all ecommerce systems integrate with Google Analytics. And if you are selling online chances are you accept PayPal® as a method of payment. So how do  track visitors who have purchased via 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.



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.

3. Click on 'Website Payment Preferences' (under 'Selling Preferences' in the right column).

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.



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, referral).

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.



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

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">

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

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

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.

Example Google Analytics Ecommerce Tracking Code:

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-XXXXX-1");
pageTracker._trackPageview();
pageTracker._addTrans(
"6NB836968U296223E", // Order ID
"", // Affiliation
"20.00", // Total
"2.00", // Tax
"0.0", // Shipping
"", // City
"", // State
"" // Country
);
pageTracker._addItem(
"6NB836968U296223E", // Order ID
"ProductId123", // SKU
"Green T-shirt", // Product Name 
"T-Shirts", // Category
"20.0", // Price
"1" // Quantity
);
pageTracker._trackTrans();
} catch(err) {}
</script>

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:

<script type="text/javascript">
<!--
var google_conversion_id = 12345678;
var google_conversion_language = "en";
var google_conversion_format = "2";
var google_conversion_color = "ffffff";
var google_conversion_label = "U10bCNfstvhghO6gM";
var google_conversion_value = 0;
if (20) {
  google_conversion_value = 20;
}
//-->
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/12345678/?value=20&label=U10bCNfstvhghO6gM&guid=ON&script=0"/>
</div>
</noscript>

Read about Google Analytics ecommerce tracking

Read 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 our Google Seminars for Success 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.

Labels: , ,

Share

Google Analytics Goals and Funnels: Back to Basics

Goals are great and it is amazing how many people don't have them setup! Goals allow you to track visitors who convert on your site, so they can provide you with really quick insights with only a few minutes of setup time.



And if you already have goals setup within Google Analytics, then I would encourage you to take a few minutes to double check you have everything setup correctly. Also, checkout the new engagement goals that are available.

Uses For Google Analytics Goals And Funnels:

  • Ecommerce transactions
  • Email newsletter subscriptions
  • Contact form leads
  • Whitepaper and PDF downloads
  • Views of critical pages

Getting Started:

To start out I would suggest setting up a traditional goal, which is simply based on the view of a key page on your site, a thank you page is best.

Start by navigating and completing the steps you expect people to take to get to the thank you page. As you go record the URLs of the pages you visit, all the way to the thank you page.

Here is an email newsletter subscription example;

1. http://www.site.com/index.html
2. http://www.site.com/news/
3. http://www.site.com/news/subscribe.html
4. http://www.site.com/news/thank-you.html

In this example I have gone from the homepage, to the news section, to the subscription form to the thank you page.

I would suggest that you just use the subscription form and the thank you page as the goal steps in this case, because people might come from other sections or pages on your site to the subscription form and so the first two steps are considered optional.

Setting Up Your Goal:

1. Click 'Edit' for the profile you are setting up a goal for on the Google Analytics account overview page.

2. Click 'Add Goal' next to a goal set.

3. Give the goal a suitable name (e.g. Newsletter Subscription).

4. Ensure 'Active Goal' is set to 'On'.

5. Set 'Goal Type' as 'URL Destination'.



6. By default match type is set to 'Head Match', leaving this default setting works in most cases.

  • Head Match: matches part of the URL (e.g. entering /page.html will match for /page.html?id=18 and /page.html?id=204)
  • Exact Match: matches the exact URL (check the top content report to ensure the URL is being tracked by Google Analytics)
  • Regular Expression Match: matches the URL based on regular expressions.

7. Enter the final conversion page as the goal URL. This is generally the thank you or receipt page. You generally want to set a goal URL that is not accessible unless a visitor has completed your desired process.

8. Optional: If your goal has a particular value you can set the dollar value for the 'goal value' input. (If you have an ecommerce site, you should setup ecommerce reporting and not set a goal value.)



9. Enter the URLs of the steps required to complete the process and give each step a suitable name. (Click 'Add Goal Funnel Step' and repeat for all the steps you have defined as critical to completing the goal.)



10. Click 'Save Changes'.

Labels: ,

Share