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.

Ecommerce measurement allows you to measure the number of transactions and revenue that your website generates. On a typical ecommerce 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 ecommerce 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 be sure to complete the final step: Copy and paste your Analytics code as the first item into the <HEAD> of every webpage on your website you want to track.
  • A Stripe account: please review the Stripe Help Center 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 in the upper right corner of your account. Under "Setup," click Linked accounts.

  3. Under "Google Analytics," click Details. 

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

  5. In the “Actions” column, click Link next to the properties 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 that you want to import site engagement metrics from. 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 Ecommerce in Google Analytics

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

Steps to Enable Ecommerce

  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 Ecommerce Settings.

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

  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 Stipe'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 localized 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 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

The Google Analytics Tracking Code should be implemented on the confirmation webpage [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 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="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 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 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
Google apps
Main menu