S2S via GTM
  • 21 Oct 2024
  • Dark
    Light

S2S via GTM

  • Dark
    Light

Article summary

To offer better efficiency and ease of use, Awin has partnered with Stape to develop and maintain a Server-to-Server Awin integration available through Google Tag Manager.

Stape offers an integration service for this portion of our tracking but you’re welcome to complete this process manually.

This method of integrating S2S requires the use of Google Cloud.

Cloud Platform Provisioning

If you’ve already set up a server-side container through GTM’s Automatic Provisioning, please make sure you are using a custom domain instead of Google’s default server container URL.

You can verify this by navigating to Admin > Container Settings and checking the Server Container URL. This URL must be a subdomain of your website.

If you’ve already completed this step separately, skip ahead to steps relating to GTM configuration.

  1. Sign into your Google Cloud Console.

  2. Navigate to Cloud Run. You can find this by searching.

  3. You should already have some services listed as below. If not, please create yours.

  4. Once these services have been created, proceed to Manage Custom Domains.

  5. Select Add Mapping, select your server-side tagging service and choose Load Balancing.

  6. In the Domain 1 field, set your new custom subdomain. We recommend you choose something easily identifiable like server-side-tagging.yourdomain.com.

  7. Cloud Platform will now request that you add the relevant DNS records to your domain management platform. Proceed based on their instructions.

Once your SSL Certificate has been updated to reflect these changes, enter GTM and your server-side container (or create one) and set the domain to your newly created subdomain.


Setting Up Awin Tracking

For our tracking to work, we’ll need to set up tags in two areas:

  • Your client-side GTM container

  • Your server-side GTM container

These two containers are responsible for their labeled environments. It’s important that you are aware of which container you’re making changes to.

Client-side GTM Configuration

If you don’t already have one, you’ll need a Google Tag and GA4 Event tag for these next steps.

If you do have these tags and you’re already passing some matching parameters, you may continue to use those but please ensure that your tags include all of the noted parameters.

In your Google Tag, you’ll need the following Configuration Parameter Keys and the related values:

Key

Value

send_page_view

true

server_container_url

{{Your container URL}}

page_url

{{Page URL}}

After you’ve set up the Google Tag, you’ll need to move on to the GA4 Event tag.

This tag is responsible for sending the actual transaction parameters to the server-side container. The names you choose for the variables associated with a given event parameter will be, in turn, how you reference them in your server-side container.

Please configure your GA4 Event tag as follows:

Server-side GTM Configuration

Now that we’ve configured the necessary client-side tags to send information to your server-side container, we can begin using these parameters in your client-side configuration.

As a part of this process, we’ll set up a few more tags to properly share the information with Awin.

Awin Tag

  1. Navigate to “Tags”.

  2. Click “New” and choose “Discover more tag types in the Community Template Gallery”.

  3. Searching for “Awin” will reveal the “Awin” server-side tag published by Stape.

  4. Add this tag to your workspace, accepting any applicable notices. This tag will need permissions to act on your behalf.

  5. Please configure this tag with the All Pages and your applicable Purchase Event as triggers. Please also apply the proper parameter variables.

  6. Once you’ve configured your Awin tag, please save the tag.

Last Click Deduplication

To enable automatic last-click deduplication, Awin’s Last Click Identifier is the quickest option. Alternatively, you may use your own internal logic but make sure your integrator has approved this process before proceeding.

This tag will read the incoming page URL and look for any configured URL appends to determine the referrer. In the case of an Awin referral, this value will be aw.

Before starting this step, you’ll need to have completed the previous sections of this article.

  1. Start by downloading this repository and ensuring that you have template.tpl extracted.

  2. After extracting this file, navigate to “Templates” in GTM and click “New”.

  3. Open the dot menu in the top right and choose “Import”. You’ll need to select the template.tpl file that you previously extracted.

  4. After importing, simply save the template. We’ll come back to this tag later.

  5. Navigate to the “Variables” section of your server-side GTM container and create a new “User Defined Variable”.

  6. This variable should be a Cookie Value type variable and given both the name and value of ServerAwinChannelCookie.

  7. Save this variable and add our newly imported AW Last Click Identifier tag to your space.

  8. With this tag, add an All Pages trigger and configure the following fields as such:

Used Source Parameters

source,utm_source,gclid,fbclid

Awin Source Values

awin,aw

Now that we’ve configured this tag, please add the ServerAwinChannelCookie variable as the chosen variable for your Awin Tag’s Last Paid Click Referring Channel parameter.

And with that last item configured, you’ve successfully set up your GTM S2S integration! All that’s left to do is run a tracking test.

If you have any questions on this process, please contact your assigned Awin Integration Analyst.


Was this article helpful?