Stape
Search
Try for free

How to set up server-side affiliate tracking using server Google Tag Manager

Updated
Feb 26, 2025
Published
Dec 5, 2021
Also available in

In this article, we will show you how to configure server-side affiliate tracking via a server GTM container. Below, we cover the following points:

1. How client- and server-side affiliate tracking works.

2. What to do before configuring server-side affiliate tracking.

3. How to configure Affiliate Conversion tag.

4. How to check whether the setup works smoothly.

Please note, here we don't cover the benefits of such a setup, if you would like to see the list of advantages and more info on Affiliate Conversion tag, see our solution page.

How does client-side affiliate tracking work?

All affiliates have a unique identifier in the affiliate network. They receive an affiliate link with their ID for every offer they work with.

When a user clicks on the affiliate link, a cookie with the unique identifier is set in a user’s browser. This cookie stores the information about the affiliate and is responsible for reporting back if a user converted. 

In some cases, client-side tracking won’t set third-party cookies with the information about the affiliate. For example, if a user clicks on the affiliate link in Safari, a cookie is not created because Safari’s ITP doesn’t allow setting third-party cookies; hence, user conversion won’t be assigned to the affiliate. Even when the affiliate network uses your domain to set cookies and make it first-party, Safari will still recognize it and decrease the lifetime of such a cookie to one day. 

How does server-side affiliate tracking work?

Server-to-server affiliate conversion uses first-party cookies. These cookies are directly communicated from the partner server to the affiliate network server. 

Let’s say you use a server Google Tag Manager container with a configured custom subdomain. You configure affiliate tags that set first-party cookies using the server Google Tag Manager. These cookies can not be blocked because they have first-party status. 

Some affiliate networks don't recommend switching exclusively to server-side tracking. They argue that browser tracking is more robust but less reliable for now. That’s why a hybrid approach is the best solution.

Server-side tracking is becoming more popular, and the most significant analytics and advertising platforms already support server-side tracking. We have a blog post that lists all platforms that support server-side tracking. Improved data tracking is not the only benefit of using server-side tagging. It can also help you increase the page speed, positively affecting organic ranking. 

Server-side affiliate conversion tracking using server Google Tag Manager

Stape created an affiliate conversion tracking tag for the Google Tag Manager server container. With the help of this tag, you can track affiliate page views and conversions on the server side. 

Affiliate Conversion tag configurations

Type:

  • PageView stores the URL parameter inside a cookie with the name: affiliate_{PARAMETER_NAME}
  • Conversion sends requests to the conversion URL. You must add a URL and select a request method (GET or POST).

You can select to clear stored parameters when a conversion occurs. In this case, you will see additional settings to specify what parameters you want to remove. 

 Query parameters: you can add parameters and use any server GTM variables here.

How do you set up server-side affiliate tracking using the Google Tag Manager server?

2. Send data to the server GTM container. We have blog posts that describe how to send data to ss GTM using Google Analytics 4 and Data Tag/Data Client.

3. Add the Affiliate Conversion Tag from the Template Gallery.

Go to your server Google Tag Manager container → Templates → Tag Templates.

Search Gallery → Choose Affiliate Conversion Tag.

Click Add to Workspace.

4. Next, you must set cookies with the affiliate ID when the user visits your site. Create a new tag with the type Affiliate tag → Type PageView → Add URL parameter that you would like to store in cookies → Set cookie lifetime → Add trigger. 

5. Test Affiliate PageView tag. You should see that this tag triggered successfully in the server Google Tag Manager Preview mode and the cookie was set. The cookie name will start with the affiliate.

6. The next step is to set up a conversion event. Each affiliate network lists required fields to be sent when a user converts. 

Create a new tag with the tag type Affiliate Conversion → Select type Conversion → Add a destination URL (you will find this destination URL in the affiliate network you are with) → Select Request method (depends on your affiliate network requirements) → Add parameters → Add trigger. 

7. Once you’ve done setting up and testing, do not forget to publish server container changes

Dedicated affiliate tags from Stape

The Affiliate Conversion Tag, as outlined in this post, is designed to track conversions across a wide range of affiliate networks.

Stape also developed tailored solutions specifically designed for the most popular affiliates:

Conclusion

If you consider affiliate marketing one of your business's traffic and conversion sources, now is the best time to improve conversion tracking by implementing server-side integration. 

Third-party cookies and client-side monitoring are no longer reliable, and their effectiveness will likely decrease further.

We hope this blog post helped you set up server-side affiliate conversion tracking. If you need help setting up server-side tracking for your site, our support can help. Just don't hesitate to contact Stape's support.

Comments

Try Stape for all things server-sideright now!