Google Tag Manager Server-Side Tagging - Implementation Guide
Warning
Deprecation Notice
The Marketing Version 202310 (Marketing October 2023) and earlier versions (excluding 202306 and 202307) have been sunset. Additionally, the unversioned APIs will be sunset soon. We recommend that you migrate to the versioned APIs as well as migrate to the new Content and Community Management APIs to avoid disruptions. See the Migration page for more details.
If you haven’t yet migrated and have questions, submit a request on the LinkedIn Developer Support Portal.
The LinkedIn Conversions API Tag template directly connects marketing data from an advertiser’s server or Google Tag Manager(GTM) and LinkedIn. This enables advertisers to measure the performance of their LinkedIn marketing campaigns no matter where the conversion happens and use this data to power campaign optimization.
This guide explains the process of configuring your GTM environment paired with a server on Google Cloud Platform (GCP) to send key web and offline event data to the LinkedIn Conversions API. Conversion event data will flow from your website through to your GTM web container to your own server container (configured with GCP) where an event tag makes the API call to LinkedIn.
The LinkedIn Conversions API Tag template is developed and maintained by LinkedIn following the Google Custom Tag Template. If you have any questions about setting up Google products, please contact your Google representative or review Google’s documentation.
This configuration guide provides the following steps:
- Prerequisites you need to implement this solution.
- How to configure your GTM web container and conversion events to work with your implementation of the GA4 Web Tag
- How to pass data from your website to your GTM web container and then to your GTM server container (on GCP)
- How to configure your GTM server container for the data to be passed to LinkedIn’s Conversions API endpoint
Prerequisites
- Review the LinkedIn’s Conversion API product, see here.
- Review Google’s Introduction to Server-Side Tagging and Custom Tag Templates
- Have GA4 conversion events configured and tracked on your website
- Have a GTM account and web container up and running
- Generate a LinkedIn API access token as outlined here.
Note
This solution is only available if you are using GA4. If your system runs on an older version than GA4, you must upgrade before proceeding.
Configuration Steps
Create a GTM Server Container
You must configure both a server container and a web container within your GTM account.
Web container
: If you do not have a GTM account already set up, start by installing a web container in your GTM account. For more information, see here.Server container
: Create a server container within your GTM account to set up a tagging server URL. For more information, see here to complete this step.
Starting up a server container requires configuring a tagging server. GCP offers a default deployment that can be completed when setting up the server container. For more information, see here. If you want to use any other cloud provider (Azure or AWS etc), you’ll need to complete the manual server setup as documented here.
Configure Your Web and Server Containers
- To configure web container, create the following:
- A
Google Tag
where you will configure theserver_container_url
. - A
GA4 Event tag
where you will configure the event schema for the conversion event that will be passed to theserver_container
and on to LinkedIn.
- A
- To configure server container, create the following:
- A
GA4 Client
that will listen for the GA4 conversion event. - A
LinkedIn | CAPI Tag
, based on the template, that will convert the standard event model from GA4 to the LinkedIn Conversions API event schema and then sends the event data to the Conversions API endpoint.
- A
1. Web Container Setup
‘Google Tag’ Configuration - Set the Tagging Server URL
In this section, you will configure your web container to send your website data to the tagging server you created earlier. Google’s documentation on sending data to the server-side tag manager can be found here.
To set up a new ‘Google Tag’, see here.
After creating a new
Google Tag
, you need to set theTag ID
and add aConfiguration Parameter
under theConfiguration Settings
.Note
- The
Configuration Parameter
field should be set toserver_container_url
and theValue
field set to theServer container URL
that is found in the server_container ‘Admin’ > ‘Container Settings’ page. - If you are setting up server-side tagging for the first time, when you add the server container URL, all of your event traffic will be sent to the server container. To continue sending data to GA4, you will need an additional GA4 server-side tag in the server container and make sure that it fires on all events you want to send to GA4.
- The
GA4 Event Tag
- Create a Conversion Event Tag
If you do not have a GA4 Event tag already set up, perform the following steps:
- Navigate to Tags > New > Template Gallery and select a new ‘GA4 Event’ tag.
- Set an Event Name and name the tag. Configure this tag to be triggered by the desired conversion event.
GA4 Event Tag
Event Schema Configuration
You will need to create a Data Layer Variable for each of the GTM Common Event Schema’s user_data parameters you want to pass to LinkedIn. These variables will then be mapped to the Data Layer Variable name. Google’s documentation on configuring data-layer variables is found here. For example, to pass a user's first name to the server container, create a variable named user_data_first_name
and then map this variable to the Data Layer Variable name user_data.address.first_name
.
The variable data will be read from the event using the common event schema. Similar to the example above, if you want to pass a hashed email address, you need to define the parameter name as user_data.sha256_email_address
. Otherwise, the ‘LinkedIn CAPI Tag’ will not be able to read the variable and pass the data on to LinkedIn’s Conversions API endpoint.
Note
If you are not using the data layer, you must configure variables for each parameter, as indicated in the table below. This table shows the mappings for LinkedIn API spec and GTM user_data parameters.
Linkedin Conversions API Parameter | GA4 Field Name | GTM Data Layer Variable Name | Required |
---|---|---|---|
ConversionUrn conversion |
conversion_rule_id | eventModel.conversion_rule_id | required |
Conversion Event Time conversionHappenedAt |
conversion_happened_at | eventModel.conversion_happened_at | required |
Event Id eventId |
event_id | eventModel.event_id | optional |
Sha256 Hashed Email SHA256_EMAIL |
user_data.sha256_email_address | eventModel.user_data.sha256_email_address | *1 of these IDs is required |
LINKEDIN_FIRST_PARTY_ADS_UUID LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID |
user_data.linkedinFirstPartyId | eventModel.user_data.linkedinFirstPartyId | *1 of these IDs is required |
Acxiom ID ACXIOM_ID |
user_data.acxiomID | eventModel.user_data.acxiomID | *1 of these IDs is required |
Moat ID ORACLE_MOAT_ID |
user_data.moatID | eventModel.user_data.moatID | *1 of these IDs is required |
First Name firstName |
user_data.address.first_name | eventModel.user_data.address.first_name | optional |
Last Name lastName |
user_data.address.last_name | eventModel.user_data.address.last_name | optional |
Country Code countryCode |
user_data.address.country | eventModel.address.country | optional |
Company Name companyName |
user_data.companyName | eventModel.user_data.companyName | optional |
Job Title title |
user_data.title | eventModel.user_data.title | optional |
conversionValue conversionValue |
user_data.currency and user_data.value | eventModel.user_data.currency, eventModel.user_data.value | optional |
2. Server Container Setup
Configure the GA4 Client
The GTM server container comes with a default GA4 client that will listen for events configured with the GA4 Web Tag. Specifically, the GA4 client will listen to the /g/collect route on the tagging server URL and then sends the eventModel (which represents all the data from the conversion event) to the downstream ‘LinkedIn | CAPI Tag’. With the default GA4 client installed in your server container, you can proceed to the tag setup. If the default GA4 client is not installed, navigate to Clients > New > Edit, select Google Analytics: GA4, add a name, and save the changes.
Configure the ‘LinkedIn | CAPI Tag’
‘LinkedIn | CAPI Tag’ is the server-side tag that converts the standard event model data from the GA4 client to the LinkedIn Conversions API event schema and sends the data to LinkedIn.
To easily send the conversion event data to LinkedIn, you must:
- Install the ‘LinkedIn | CAPI Tag’ from the Community Template Gallery.
- Navigate to Tags > New > Edit > Community Template Gallery and select ‘LinkedIn | CAPI Tag’.
Note
- Select the correct called ‘LinkedIn | CAPI Tag’ by LinkedIn-developers.
- You can configure this tag to be triggered by any events received by the GA4 client and sent to LinkedIn.
- To install this tag, you will need the conversion rule ID and a LinkedIn API access token. See OAuth Token Generation documentation here and Postman Getting Started guide here. Click here to generate an access token now.
Note
The conversion rule ID can be found by navigating to the conversion rule in question within Campaign Manager, opening the settings page, and navigating to step 3. On this screen, select the option Use a tag manager, scroll down, and you’ll see the ID under Conversion ID for Google Tag Manager. Paste both your access token and the conversion rule ID into the tag configuration page.
Once you have configured the above steps, you are set to begin streaming conversion events to LinkedIn’s conversions API.
To test and inspect your setup, utilize Google Tag Manager’s preview mode, which is available on both the web container and the server container.