Introduction
Using Server-Side Tracking with Axeptio offers numerous benefits:
- Extended Cookie Lifetime: Axeptio cookies are set server-side, reducing the risk of deletion by client-side blocking mechanisms, especially with Safari and its ITP.
- Bypassing adblockers: By calling the SDK from a client-specific subdomain, adblockers can be circumvented.
- Improved compliance: Using a custom domain for SDK and consent API calls enhances privacy and transparency for users.
Prerequisites
Before you begin, you’ll need:
- Axeptio Tag (Client-Side): Available in the template gallery: Axeptio CMP
- Axeptio Client sGTM (Server-Side): Available from GitHub: axeptio-sgtm-public-template.
- Axeptio sGTM Tag (Server-Side): Available in the template gallery or GitHub: axeptio-client-sgtm-public-template.
Step 1: Configure the transport URL (postConsentUrl)
The first step is to define the URL that will be used as the transport URL, similarly to what you can set up in a GA4 tag. Here’s how to configure the transport URL:
In your Axeptio SDK configuration, add the parameter postConsentUrl
with the URL of your server-side infrastructure. This parameter allows to redirect consent requests to your own infrastructure, avoiding third-party URLs and improving privacy.
Set the server-side URL in Axeptio settings:
- If you’re using our GTM template (Recommended):
- If you’re integrating Axeptio in HTML, add the parameter to axeptioSettings:
Step 2: Install the Axeptio server-side client
The second step involves installing the Axeptio server-side client to manage cookies and consent directly via your server.
-
Download the Axeptio client for Server-Side GTM:
- Visit Axeptio’s GitHub repository: axeptio-sgtm-public-template.
- Follow the installation and configuration instructions to integrate this client into your server-side infrastructure.
This client will work alongside the GA4 client and claim Axeptio requests.
Step 3: Add the Axeptio tag in Server-Side GTM
After installing the server-side client, you now need to configure the Axeptio tag in your Server-Side GTM container.
-
Get the Axeptio tag:
- Download the Axeptio tag from the Template Gallery or GitHub: https://github.com/axeptio/axeptio-sgtm-public-template
-
Add the tag to GTM:
- Import the Axeptio tag template into your GTM container.
- No additional configuration is needed; it’s pre-integrated.
Step 4: Configure a trigger for the Axeptio Client
To ensure the tag fires correctly, you need to configure the appropriate trigger in GTM.
-
Set up a client call trigger:
- Create a trigger in sGTM that fires on each call from the Axeptio client.
- This trigger will activate the Axeptio tag whenever a consent event is detected by the Axeptio client.
-
Testing and validation:
- Test the configuration using GTM’s preview mode to confirm that consent events are properly recorded server-side.
- Verify that cookies are set correctly and tracking complies with users’ consent preferences.
How to verify my Server-Side sGTM installation
Launch the preview mode on both of your client-side and server-side GTM containers to check whether requests are sent and received as expected.
Step 1: Outgoing request
Launch the client-side preview mode. Once your site is loaded, open the developer console, and check the Network tab. When you submit your consent, a request should be sent to your server-side infrastructure.
Step 2: Incoming request
In the server-side preview, you should see that a new request is received. This request will be claimed by the Axeptio client, which will load the tag.
Conclusion
By following these steps, you’ve successfully set up Server-Side Tracking with Axeptio. This setup extends the lifespan of Axeptio cookies, bypasses adblockers, and enhances user privacy by using a custom transport URL.
Regularly check server logs to ensure smooth operation and adjust the configuration if necessary. You now have a robust solution for managing consent and cookies securely and effectively! 🎉🚀