Google Analytics

How to Track Affiliate Sales in Google Analytics?

Integrating with Google Analytics enables you to push sales generated by users to your Google Analytics account. This provides insights into your channel performance, traffic sources, landing pages, and content.

With Strackr, there's no need to cloak your URLs or connect to an external API to modify your links, ensuring fast page loads for your visitors. We utilize subids/customs to relay the anonymous Client ID to the transaction. Subsequently, Strackr fetches the transactions using this Client ID and pushes them to your Google Analytics account.

This guide will walk you through integrating with two easy steps:

  1. Enable the Ecommerce feature in Google Analytics, find your Measurement ID and your API Secret.
  2. Install our JavaScript snippet (roughly 3ko gzipped) or do it manually.

Settings on Google Analytics

In this section we will make 3 actions:

  • Find your Measurement ID
  • Find your API Secret
  • Enable the Ecommerce feature

All these actions will be on your Data Stream page: go to the Admin page, in the Data collection and modification column, select Data Streams, and click on your web data stream.

  1. Measurement ID Your “G-” Measurement ID appears in the top-right corner, e.g., G-1111111111. Copy this ID:

    Measurement ID

  2. API Secret click on Measurement Protocol API secrets, you will arrive on this page, click on Create:

    Create measurement Protocol API

    Add a Name and Create:

    Name API Secret

    Copy your API Secret:

    Measurement Protocol APISecret

  3. Enable the Ecommerce feature To enhance sales attribution accuracy, extend the session duration to the maximum of 7 hours and 55 minutes.

    On the Data Stream page, click on Configure tag settings, then Adjust session timeout:

    Select the maximum value and save your changes:

Your Google Analytics 4 account is now set up.

Strackr Integration

1. In Strackr, go to the Integrations section, click on the Google Analytics tab, and select Add an account. Enter the Measurement ID and Secret ID you retrieved from Google Analytics:

Add Google account

Optionally, you can specify a URL that will be used as the HostName in your Google Analytics reports.

Once added, you'll receive your Strackr Tracking ID (STID), which is a 5-character ID, e.g., gSfhP.

2. On the same page, click on the JavaScript snippet icon on the right to view the Javascript snippet. Paste this after the Google Analytics tag on each page where you want to track sales:

Javascript snippet

That's it! Strackr will handle sending transactions to Google Analytics, enabling you to track performance metrics such as landing pages, channels, sources, mediums, campaigns, devices, demographics, and locations.

Additional Information

  • If you utilize subids/customs in your URLs, our script will append an empty parameter without replacing your existing subids.
  • If an adblocker blocks Google Analytics, you might not see the transaction in Google Analytics, or only the transaction without the related site navigation.
  • Safari might block third-party Javascript from accessing the Google Analytics Javascript API. In this case, we recommend proxying our script. For more details, visit this page.

Next Steps

    Get started for free

    30 days free trial, no credit card required. Connect to your networks within minutes — and cancel anytime.

    Try for free

    Try the live demo

    Not quite ready to sign up? Take a test drive of the Strackr dashboard in our interactive live demo.

    See the live demo

    Still have questions?

    If there’s anything else you want to know about Strackr, contact us and we’ll be happy to fill you in.

    Contact us