Conversion tracking guide for Ad Grants and Stripe

How to track transaction-specific conversions with Stripe fundraising tools

In order to track donations with Stripe, it’s best to send an 'event' with Google Analytics for confirmed e-commerce transactions.

E-commerce measurement allows you to measure the number of transactions and revenue that your website generates. On a typical e-commerce site, once a user clicks the 'purchase' button in the browser, the user's purchase information is sent to the web server, which carries out the transaction. If successful, the server redirects the user to a 'Thank you' or receipt page with transaction details and a receipt of the purchase.
 
You can use the analytics.js library to send the e-commerce data from the 'Thank you' page to Google Analytics.

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

Before you begin

Here's what you'll need before you can set up conversion tracking for transaction-specific values on your website and Kindful donation pages:

  • An Ad Grants account: Don't have one yet? Follow these steps to set one up.
  • A Google Analytics account:  it’s at no cost, and if you don’t have one, follow these steps to set one up. Please make sure that you complete the final step: copy and paste your Analytics code as the first item into the <HEAD> of every web page on your website that you want to track.
  • A Stripe account: please review the Stripe Help Centre if you need help with your donation form.

This article goes right to the setup instructions. To learn more about how conversion tracking works and why to use it, read: About conversion tracking.

 


Step 1: Link your Google Analytics account to your Google Ads account

Your Ad Grants account can use information from your Google Analytics account to help improve the performance of your ads. To link your account, follow these instructions

Steps to link Google Ads and Google Analytics

  1. Sign in to your Google Ads account.

  2. Click the tools icon at the top-right corner of your account. Under 'Setup', click Linked accounts.

  3. Under 'Google Analytics', click Details. 

  4. You'll see a list of the Google Analytics properties to which you have access. The 'Status' column shows whether a property is linked to Google Ads. (If you can't see an Analytics property here, make sure that you have 'Edit' permission to that property.)

  5. In the 'Actions' column, click Link next to the properties that you want to link to Google Ads. You can link as many properties as you’d like.

  6. Now you'll see one of the two screens described below:

    • If the property you chose only has one view, you'll see the name of just that view. Select Import site metrics to be able to see Google Analytics data in Google Ads reports.

    • If the property has multiple views, you'll see a list of the views that you can link. For each view, you can do the following:

      • Link: This will make Google Ads click and cost data available in Analytics, and Analytics goals and transactions available for import into Google Ads. Link as many views as you'd like. 

      • Import site metrics: (Recommended) Choose one view from which you want to import site engagement metrics. This view will be used to show site engagement metrics in the Google Analytics reporting columns of your account. Note that you’ll need to add Google Analytics columns to your Google Ads reports. In most cases, it will take less than an hour for Google Analytics data to be imported, but the process may take longer for larger accounts. Once the data is imported, you can add Google Analytics columns to your Google Ads reports.

  7. Click Save.

Step 2: Enable e-commerce in Google Analytics

After implementation, we’ll need to make sure that we enable the e-commerce feature in your Analytics account.

Steps to enable e-commerce

  1. Sign in to Google Analytics.
  2. Click Admin, and on the far-right side, confirm that the view column corresponds to your fundraising website. 

  3. In the VIEW column, click E-commerce settings.

  4. Set Enable e-commerce to ON. [There is no need to enable 'Enhanced e-commerce'.]

  5. Click Next step.

  6. Click Submit.

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

Step 3: Send customer back to your website after checkout

Use stripe.redirectToCheckout to redirect your customers to Checkout, a Stripe-hosted page to securely collect payment information. When the customer completes their purchase, they are redirected back to your website. More information on what information to collect in the checkout is available on Stripe's guide here.

The success URL is where you want Stripe to send customers when payment is complete. 

Example of a redirectToCheckout call:

stripe
  .redirectToCheckout({
    items: [
      // Replace with the ID of your SKU
      {sku: 'sku_123', quantity: 1},
    ],
    successUrl: 'https://your-website.com/success',
    cancelUrl: 'https://your-website.com/canceled',
  })
  .then(function(result) {
    // If `redirectToCheckout` fails due to a browser or network
    // error, display the localised error message to your customer
    // using `result.error.message`.
  }); 

If you’d like access to the Checkout session for the successful payment, read more about it in Stripe's guide on fulfilling your payments with webhooks.

Step 4: Track Analytics events on your 'thank you' page

When your customer successfully completes their payment or initiates a subscription using Checkout, Stripe redirects them to the URL that you specified in the successURL parameter. Typically, this is a page on your website that informs your customer that their payment was successful.

In order to track e-commerce transactions, both the payment details and the customer need to be sent back to [www.your-site.com] once the transaction is completed with Stripe Checkout. The Google Analytics E-commerce 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

The Google Analytics tracking code should be implemented on the confirmation web page [https://example.com/success] 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 [www.your-site.com] on the confirmation web page 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 e-commerce site and a separate shopping basket 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 you 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="https://www.googletagmanager.com/gtag/js?id=GA_MEASUREMENT_ID"></script>

<script>

  window.dataLayer = window.dataLayer || [];

  function gtag(){dataLayer.push(arguments);}

  gtag('js', new Date());

 

  gtag('config', 'GA_MEASUREMENT_ID');

</script>

 

gtag('config', 'GA_MEASUREMENT_ID', {

  'linker': {

    'domains': ['checkout.stripe.com']

  }

});

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'

    }

  ]

});

Step 5: Add your URL to the referral exclusion list

When your donor crosses from your primary domain (yournonprofit.org) to your Stripe checkout page, Analytics interprets that as the donor having been referred by your primary domain to your secondary domain, and Analytics counts that as separate visits. This doesn’t accurately reflect your donors’ experience, so we recommend setting up an exclusion list.

Please follow the instructions for implementing a referral exclusion list, adding any subdomains that you may have for donations, special events or merchandise.

Steps to add referral traffic sources

  1. Sign in to your Analytics account.
  2. Click Admin.
  3. In the ACCOUNT column, select the Analytics account that contains the property that you want to work with.
  4. In the PROPERTY column, select a property.
  5. Click Tracking info.
  6. Click Referral exclusion list.
  7. To add a domain, click +ADD REFERRAL EXCLUSION.
  8. Enter the Domain name.
  9. Click Create to save.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
8031332175750923514
true
Search Help Centre
true
true
true
false
false