Skip to main content
Difficulty: Intermediate
Developer Required: Depends on your signup flow
Use Google Tag Manager (GTM) to add the FirstPromoter scripts to your website without editing its code. You’ll add two tags: the main tracking script records visits from referral links, and the referral tracking tag records signups.
This guide assumes the GTM container is already installed on your website.

Main tracking script

1

Copy the main tracking script

In FirstPromoter, go to Settings > Integrations, open the website integration setup, choose the JS option under Custom integration, and copy the Main tracking script. It looks like this, with your account ID filled in:
2

Create a Custom HTML tag

In your GTM workspace, go to Tags and click New. Click Tag Configuration and choose Custom HTML.
3

Paste the script

Paste the main tracking script into the HTML field.
4

Set the trigger

Click Triggering and select Initialization - All Pages. This loads FirstPromoter before your other tags, so the referral tag can use it.
5

Save and publish

Name the tag FirstPromoter - Main tracking script and click Save. Then click Submit and Publish to make the change live.

Referral tracking

When a visitor signs up or submits an opt-in form, send their email to FirstPromoter with fpr("referral"). Pick the option that matches how your signup works.
Use this when your form redirects to a thank-you page that has the email in its URL, for example https://yoursite.com/thank-you?email=jane@example.com.
  1. Create a new Custom HTML tag and paste the script below.
  2. Click Triggering, click + to create a new trigger, and choose Page View.
  3. Select Some Page Views and add a condition matching your thank-you page, for example Page Path contains /thank-you.
  4. Name the tag FirstPromoter - Referral tracking, save it, then submit and publish your container.
If the URL parameter is not called email, change get("email") to match it.
If your signup creates the account on your server, you can track the referral with the API instead. Keep the main tracking script in GTM so clicks are still recorded.

Testing your setup

  1. In GTM, click Preview, enter your website URL with a referral link from one of your affiliates (for example https://yoursite.com/?fpr=joe13), and click Connect.
  2. In Tag Assistant, check that FirstPromoter - Main tracking script fired. In your browser’s developer tools, the _fprom_tid and _fprom_ref cookies should now be set.
  3. Sign up or submit your form, and check that FirstPromoter - Referral tracking fired.
  4. Open the affiliate in your FirstPromoter dashboard and confirm the new referral appears.

Common issues

  • Tag not firing: check that the trigger conditions match your page or form, and that you published the container. Preview mode does not change your live site.
  • Referral tag fired but nothing appears in FirstPromoter: the visitor must have arrived through a referral link first, in the same browser. Ad blockers can also block tracking requests. To avoid that, set up a proxy.
  • Consent banner: if your consent tool blocks tags until the visitor accepts, configure the FirstPromoter tags to follow the same consent settings as your other analytics tags.

Sales tracking

Sales are tracked through your billing integration (Stripe, Chargebee, Paddle and others), not through GTM. Make sure the email (or user ID) sent with the referral is the same one your billing provider sends, so FirstPromoter can match the sale to the referral.