- 21 Oct 2024
- DarkLight
S2S via GTM
- Updated on 21 Oct 2024
- DarkLight
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.
Sign into your Google Cloud Console.
Navigate to
Cloud Run
. You can find this by searching.You should already have some services listed as below. If not, please create yours.
Once these services have been created, proceed to
Manage Custom Domains
.Select
Add Mapping
, select your server-side tagging service and chooseLoad Balancing
.In the
Domain 1
field, set your new custom subdomain. We recommend you choose something easily identifiable likeserver-side-tagging.yourdomain.com
.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 |
|
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
Navigate to “Tags”.
Click “New” and choose “Discover more tag types in the Community Template Gallery”.
Searching for “Awin” will reveal the “Awin” server-side tag published by Stape.
Add this tag to your workspace, accepting any applicable notices. This tag will need permissions to act on your behalf.
Please configure this tag with the
All Pages
and your applicablePurchase Event
as triggers. Please also apply the proper parameter variables.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.
Start by downloading this repository and ensuring that you have
template.tpl
extracted.After extracting this file, navigate to “Templates” in GTM and click “New”.
Open the dot menu in the top right and choose “Import”. You’ll need to select the template.tpl file that you previously extracted.
After importing, simply save the template. We’ll come back to this tag later.
Navigate to the “Variables” section of your server-side GTM container and create a new “User Defined Variable”.
This variable should be a
Cookie Value
type variable and given both the name and value ofServerAwinChannelCookie
.Save this variable and add our newly imported
AW Last Click Identifier
tag to your space.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.