Skip to content

How to Add Google Analytics Tracking Code

Overview

AffiliatePro has two separate fields for Google Analytics tracking code depending on which part of the platform you want to track:

Field Tracks Where to find it
Google Analytics For Site Page Affiliate panel, admin panel, and front-end site pages Settings → General Settings → Site Settings tab
Google Analytics For Store Page Store pages only Marketing → Store → Settings → Contact & Analytics tab → Analytics & Custom Scripts section

To track your entire platform, paste your code into both fields.

Step 1 — Get your tracking code from Google

  1. Go to Google Analytics and open your property.
  2. Go to Admin → Data Streams, then click on your web stream.
  3. Click View tag instructionsInstall manually.
  4. Copy the full <script> block provided by Google. It looks like this:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

Step 2 — Add tracking to the affiliate panel and front-end site

  1. In the top navigation bar, click Settings.
  2. From the dropdown, click General Settings.
  3. The Site Settings tab opens by default.
  4. Scroll down to the Google Analytics For Site Page section.
  5. Paste the full <script> code block into the textarea.
  6. Click Save Settings.

This field also has a Global Script field above it where you can inject any custom script and select which sides it appears on: Admin, Affiliate, Front, or Store. You can use this as an alternative if you want full control over where the code loads.

Step 3 — Add tracking to the store pages

  1. In the top navigation bar, click Marketing.
  2. From the dropdown, click Store.
  3. Click Settings in the Store nav bar or the Settings card in the Store Management Hub.
  4. Click the Contact & Analytics tab.
  5. In the Analytics & Custom Scripts section, find the Google Analytics For Store Page field.
  6. Paste only the JavaScript — no <script> tags. Example:
gtag("config", "G-XXXXXXXXXX");

The store analytics field expects JavaScript only — do not include the <script> opening and closing tags. The platform wraps the code automatically.
  1. Click Save.

Verify tracking is working

After saving, open your site in a browser and use the Google Tag Assistant browser extension, or check Google Analytics → Reports → Realtime to confirm events are being received.

Was this article helpful?

8 views