La pagina richiesta al momento non è disponibile nella tua lingua. Puoi selezionare una lingua diversa nella parte inferiore della pagina oppure tradurre istantaneamente qualsiasi pagina web nella lingua che preferisci tramite la funzionalità di traduzione integrata di Google Chrome.

Conversion tracking guide for Ad Grants and PayPal

How to track transaction-specific conversions with PayPal donations

In order to track Donations with PayPal, both the payment details and the customer need to be sent back to [] once the transaction is completed on

The conversion tracking code can then be executed with the relevant payment details being used as values.

To accomplish this, the following steps need to be followed. 

Before you begin

Make sure you have the following before proceeding to setup conversions in Google Ads with PayPal.

  • An Ad Grants and/or Google Ads account: Don't have one yet? Check if you're eligible for an Ad Grants account.

  • Check whether you are using Google Ads conversions (if so, use Step 1A) or importing from Google Analytics (if so, use Step 1B). You can tell this by looking at the "source" of where your conversions are coming from. In the upper right corner, click the Tools icon , and under "Measurement," click "Conversions." If the source for your conversions says "Website," you're using Google Ads conversions. If the source says "Analytics," you're importing data from Google Analytics.

  • A PayPal account: please review the PayPal Help Center if you need help with your donation form.

This article is intended for use after global site tag implementation. If you still need to implement the global site tag on your website, read Use the global site tag for Google Ads conversion tracking

Step 1A: Changing Your Website Conversion Tracking using Google Ads

To use Google Ads Conversion Tracking with PayPal on your website, you will need to put a small snippet of HTML code on the page that customers see after they've completed a valuable action on their site. For example, you could add the code to your purchase confirmation page. This is the same process for both Mobile and Desktop Websites.

Steps to set up a website conversion for PayPal

  1. Ensure the specific account has a properly functioning website that is able to be edited with the conversion tracking tag.

  2. Sign in to your Google Ads account.

  3. In the upper right corner, click the Tools icon , and under "Measurement," click "Conversions."

  4. Click the plus button .

  5. Click Website.

  6. Next to “Conversion name,” enter a name for the conversion you’d like to track, such as “newsletter sign up” or “wedding bouquet purchase.” This will help you recognize this conversion action later in conversion reports.

  7. Next to “Category,” select a description for your conversion action from the drop-down. The category allows you to segment your conversions in reports, so you can see similar conversions together.

    1. Use “Purchase” in order to track donations on your donation page.

  8. Next to “Value,” select how to track the value of each conversion.

    1. Use different values for each conversion. Use this option if, for example, you’re tracking purchases of products with different prices. Later, when you add your conversion tracking tag, you’ll need to customize your tag to track transaction-specific values

  9. Next to “Count,” select how to count these conversions.

    1. Every. This setting is best for sales, when every conversion likely adds value for your business.

  10. Click Conversion window. Select how long to track conversions after an ad interaction from the drop-down. The window can be 1 to 90 days. Learn more about conversion windows.

  11. Click View-through conversion window. Select how long to track view-through conversions from the drop-down. The window can 1 to 30 days.

  12. Click Include in “Conversions.” This setting—selected by default—lets you decide whether or not to include data for this conversion action in your "Conversions" reporting column. If you uncheck this setting, data will still be included in the "All conversions" column. You might want to uncheck this setting if you use Smart Bidding, and you don't want to include this particular conversion action in your bid strategy. Learn more about the "Include in 'Conversions'" setting.

  13.  Click Create and continue.

  14. Move on to Tag Setup and "Install the tag yourself" to see the code. As a reminder, you'll need to add 2 code snippets to your website: the global site tag and the event snippet. If you've already implemented the global site tag on all pages, choose "The global site tag on all pages was installed already when you created another conversion action in this Google Ads account."

  15. Next to "Event snippet," select whether to track conversions on a page load or click. Choose Page load so you're able to count conversions when customers visit the conversion page, such as a confirmation page for a purchase or sign-up. This is the default and most common option.

  16. Copy the snippet and paste it in between the <head></head> tags of the page(s) you'd like to track, right after the global site tag.

Example of finished code, with the added value, currency, and transaction_id:

<!-- Event snippet for Paypal Donation -dynamic conversion values conversion page -->
  gtag('event', 'conversion', {
      'send_to': 'AW-1234567890/ZZZ123ZZZ123ZZZ123_Z1',
      'value': '',
      'currency': '',
      'transaction_id': ''
<!-- End Event snippet for Paypal Donation -dynamic conversion values conversion page -->    

Step 1B: Changing Your Website Conversion Tracking using Google Analytics Ecommerce Tracking

In order to track E-Commerce transactions, both the payment details and the customer need to be sent back to [] once the transaction is completed on The Google Analytics Ecommerce Tracking code can then be executed with the relevant payment details being used as values. In order to accomplish this, the following Steps need to be followed.

Steps to edit your Analytics E-Commerce Tracking Code

Although the Google Analytics Tracking Code should not be implemented on the hidden webpage, it should be implemented on the confirmation webpage along with the Google Analytics E-Commerce tracking code. This will allow your business to identify the number of transactions completed along with each transaction’s details. Please complete the following sub-steps to accomplish this implementation.

  1. Implement the same global site tag tracking code used throughout [] on the confirmation webpage before the closing </head> tag (shown below). 

  2. In addition to the global site tag, it's important to add cross-domain tracking for PayPal to automatically link the domains. Cross-domain measurement is a Google Analytics feature that allows you to see sessions from two related sites (such as an ecommerce site and a separate shopping cart site) as a single session, rather than as two separate ones. This is sometimes called 'site linking', and it allows you to more effectively measure the entire customer journey.

  3. Implement a Custom Variable for each additional piece of information that would like to be collected, such as transaction_id, value, and currency.

  4. Implement the Google Analytics E-Commerce tracking code within the same code snippet as the global site tag.

To measure a transaction, send a purchase event with the items in the transaction. For example:

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src=""></script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_MEASUREMENT_ID');


gtag('config', 'GA_MEASUREMENT_ID', {
  'linker': {
    'domains': ['']

gtag('event', 'purchase', {
  "transaction_id": "24.031608523954162",
  "affiliation": "Google online store",
  "value": 23.07,
  "currency": "USD",
  "tax": 1.24,
  "shipping": 0,
  "items": [
      "id": "P12345",
      "name": "Android Warhol T-Shirt",
      "list_name": "Search Results",
      "brand": "Google",
      "category": "Apparel/T-Shirts",
      "variant": "Black",
      "list_position": 1,
      "quantity": 2,
      "price": '2.0'
      "id": "P67890",
      "name": "Flame challenge TShirt",
      "list_name": "Search Results",
      "brand": "MyBrand",
      "category": "Apparel/T-Shirts",
      "variant": "Red",
      "list_position": 2,
      "quantity": 1,
      "price": '3.0'

Steps to enable Ecommerce

After implementation, we’ll need to be sure to enable the Ecommerce feature in your analytics account. To do that:


  • In the VIEW column, click Ecommerce Settings.


  • Set Enable Ecommerce to ON. [There is no need to enable “Enhanced eCommerce.]

  • Click Next step.

  • Click Submit.

For more details on this feature, please find help here.

Step 2: Enable Payment Data Transfer (PDT)

By enabling the Payment Data Transfer (PDT) within your PayPal account, will allow the secure transfer of payment details such as the item purchased, the transaction amount and the geographical location of the buyer, to your website. In order to successfully retrieve the payment details, [] must send a PDT identity token to the PayPal domain. To enable PDT and retrieve the appropriate PDT identity token that needs to be sent, please follow these sub-steps:

Steps to set up PDT on PayPal

  1. Log into the relevant PayPal account.
  2. In your Profile, choose My Selling Tools on the left.
  3. Click on Update for Website Preferences.
  4. In Auto Return for Website Payments, click the On option.
  5. For the return URL, enter the URL on your site that will receive the transaction ID posted by PayPal after a customer payment. Payment Data Transfer requires the Return URL setting. 
  6. In Payment Data Transfer, click the On option.
  7. Click Save.
  8. Repeat steps 2 and 3.
  9. To view your PDT identity token, scroll down to the Payment Data Transfer section on the page.
  10. Copy and save it; add it to the script on your Return URL page. Specify the [] hidden webpage URL (detailed in Step 4) for the Return URL value, that both the customer and the transaction ID will be sent to once the transaction has been processed by PayPal.
  11. Write a script that parses the URL-encoded key-value pair string sent to your Return URL page and displays transaction details on this page. See the PDT-specific variables for PayPal's PDT keys (variables). There are additional variables that are shared between the IPN and PDT notification services; a comprehensive list can be found in the IPN and PDT variables reference.
  12. To fulfill orders or take other advanced actions that rely on a database, add to your script as needed.
  13. Test your integration using the PayPal sandbox. First, log in to the Sandbox section of the PayPal developer site and setup sandbox accounts. Then log into the PayPal sandbox with a test merchant account and repeat the Website payment preferences setup steps mentioned above in your sandbox account profile. For more information on Sandbox testing, see the Sandbox guide
  14. You're ready to go live once you've verified that your implementation works correctly in the PayPal sandbox.


More information on Payment Data Transfer (PDT) is available in PayPal Developer.

Step 3: Create Return URL Webpage to collect PayPal Payment Data

The URL to receive the PDT should be specified as the Return URL value in Steps 1 and 2. Once all steps below have been carried out, this hidden webpage will be sent the details of each transaction completed on

A webpage should be created on [] that is not part of the website’s sitemap e.g. []/processtransaction.aspx. Such a webpage is often referred to as a “hidden webpage” within the web development industry. 

Step 4: Create the PayPal Donate Button

A PayPal “Donate” button should be created that will send the customer back to []. 

Note: If you've already created the PayPal Donate Button, please ensure you are updating the return URL to the webpage you created in Step 3.


This can be accomplished by completing the following sub-steps: 

  1. Log in to your PayPal Premier or Business account at Your PayPal account Summary page opens.

  2. At the top of the page, select Tools, and then All Tools.

  3. Scroll to the PayPal buttons tile and click Open.

  4. Select the type of button you want to create. In this case, Donation. The Create PayPal payment button page opens and displays the button's configuration options.

  5. Follow the on-screen instructions from the Create PayPal payment button webpage currently displayed to create the button.

  6. Ensure the button directs the customer to the return URL (detailed in Step 3).

More information on Button setup and editing is available in PayPal Developer.

Step 5: Retrieve Transaction Details

Once a customer successfully completes the payment process and selects the “Donate” button, this will result in sending the transaction ID via a HTTP GET request method to the hidden webpage as a parameter attached to the Return URL. This parameter will appear on the end of the Return URL e.g. []/processtransaction.aspx?tx=transactionID. 

What follows is HTTP POST which indicates whether the payment was successful on the Return URL page. Once the transaction ID is received, a FORM via HTTP POST should be sent to PayPal that includes both the received transaction ID and the identity token.

Steps to set up transactions to the hidden webpage

  1. Send FORM - Once the transaction ID is received, a FORM via HTTP POST should be sent to PayPal that includes both the received transaction ID and the identity token noted in Step 2. The form posted should look similar to the following:    

<form method=post action="">


<input type="hidden" name="cmd" value="_notify-synch"> 


<input type="hidden" name="tx" value="theTransactionID"> 


<input type="hidden" name="at" value="theIdentityToken"> 


<input type="submit" value="PDT"> 



The first line of PayPal’s response to the FORM will contain either “Success” or “Fail” to indicate whether the request was successful. An example of a successful response (without the HTTP Header) would look similar to the following:














Please review the list of all possible PDT variables and values that PayPal can return and make use of those in the FORM that will be beneficial for the business to retrieve.

  1. Store and Send Transaction Details - The transaction details that will be received from need to be stored and sent by the hidden webpage onto a “confirmation” webpage (detailed in the next sub-step). A query string, cookies or post variables could be used to send the details to the confirmation webpage. It is recommended to use a JavaScript redirect from the hidden webpage to send the customer to the confirmation webpage. Just in case the hidden webpage is seen by the customer it is recommended to display text such as “Transaction processing...” to provide details on the purpose of the hidden webpage. 

  2. Create Confirmation Webpage – This should be the last webpage displayed to the customer in the transaction process e.g. []/confirmationpage.aspx. It will confirm that the transaction was successful.

  3. [Optional] If you use Google Analytics for reporting: Append Google Analytics Parameter – The “__utmz” Google Analytics cookie would have been set when the customer visited [] to begin the application process. This cookie stores campaign/referrer information (the campaign/referring website that brought the customer to []). To ensure that this referrer information is not changed due to the customer returning to the website from, a “utm_nooverride=1” Google Analytics parameter should be used. The confirmation webpage URL should contain this parameter when the customer is redirected to it from the hidden webpage e.g. []?utm_nooverride=1.

È stato utile?

Come possiamo migliorare l'articolo?

Hai bisogno di ulteriore assistenza?

Prova i passaggi successivi indicati di seguito:

Clear search
Close search
Google apps
Main menu