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

Author
Stape
Published
December 05, 2021
Also available in

Affiliate marketing is an excellent way to generate revenue for your business. On the other side, it is also a great way to monetize a website for affiliates and can be highly profitable if done correctly. 

Due to tracking restrictions and ad blockers, affiliate conversion tracking has become challenging. Affiliates can lose up to 40% of their sales because of client-side tracking. It happens because browser tracking is no longer reliable. Apple’s Intelligent Tracking Prevention (ITP), Firefox's Enhanced Tracking Protection (ETP), ad blockers, restrict the use of third-party cookies.  

That is why you might need to consider implementing server-side affiliate tracking. Some well-known affiliate networks, like Awin, already made server-side tracking mandatory for all their partners. 

In this blog post, I want to discuss how server-side affiliate conversion tracking works and how to set it up using server Google Tag Manager. 

How does client-side affiliate tracking work?Copy link to this section

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 1 day. 

How does server-side affiliate tracking work?Copy link to this section

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 are using a server Google Tag Manager container with a configured custom subdomain. Using server Google Tag Manager, you configure affiliate tags that set first-party cookies. These cookies can not be blocked because they have first-party status. 

Some affiliate networks do not recommend switching to server-side tracking only. They say that browser tracking is more robust but less reliable for now. That is why a hybrid approach is the best solution. 

Server-side tracking is becoming more popular, and the biggest 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. 

Benefits of server-side affiliate trackingCopy link to this section

For affiliatesCopy link to this section

More conversions will be tracked, meaning more revenue for affiliates. Awin's research analyzed 150,000 tracking calls and saw 12,6% more cookies were set with the server-side implementation. Most of the time, client-side cookies were blocked by browsers that restrict the use of third-party cookies (like Safari or Firefox), and the rest by AdBlockers. 

For companiesCopy link to this section

Improved page speed.

Let’s say you have offers in 3 affiliate networks. All these affiliate networks require you to add their tracking code. Meaning you will need to add 3 JavaScript to your site, and these JavaScripts will slow down your site. 

Better data security.

When you add affiliate JavaScript on the site, you can not control what data it collects. It can grab more data than you agreed to. For example, it may scrape users’ PII from your site, violating your privacy policy and GDPR. With server-side, you can completely control what data was sent to the affiliate network.

A better understanding of results from affiliate marketing.

You will be able to track all conversion that comes from affiliates. It has two positive affect:

  • A clear understanding of where your conversions are coming from.
  • More attractive offer for affiliates: If affiliates see that your offer brings them more money, they will send more traffic to your website, meaning more sales for you.

Server-side affiliate tracking using server Google Tag ManagerCopy link to this section

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 server-side. 

Affiliate Conversion tag configurations:Copy link to this section

Type:

  • PageView stores URL parameter inside a cookie with the name: affiliate_{PARAMETER_NAME}
  • Conversion sends requests to the conversion URL. Here you will need to 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 to set up server-side affiliate tracking using server Google Tag Manager?Copy link to this section

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

3. Download Affiliate Conversion Tag from GitHub -> Open templates sections in the server Google Tag Manager container -> Click New. Or add it from the Community Template Gallery

4. Click three dots in the top right corner -> Click Import -> Select Affiliate conversion tag template you’ve recently downloaded from GitHub -> Click save. 

add affiliate tag to server google tag manager

5. The first step would be to set cookies with the affiliate ID when the user visits your site. Create a new tag with type Affiliate tag -> Type PageView -> Add URL parameter that you would like to store in cookies -> set cookie lifetime -> Add trigger. 

affiliate pageview tracking server-side

6. 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.

test affiliate pageview tracking

7. The next step would be to set up a conversion event. Each affiliate network has a list of required fields that should 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 with) -> Select Request method (depends on your affiliate network requirements) -> Add parameters -> Add trigger. 

affiliate conversion tracking server-side 

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

ConclusionCopy link to this section

If you consider affiliate marketing as one of your business's traffic and conversion sources, now is the best time to start improving conversion tracking by implementing server-side integration. Third-party cookies and client-side tracking are no longer reliable. And it will get even less reliable when Chrome phases out of third-party cookies.

I 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, stape’s agency can help. Just send an email to agency@stape.io.  

Tagged with:GTMsGTM tag

Host your GTM server at Stape

By signing up you agree to Stape’s Terms of Use and Privacy Notice