Getting Started
Setup Guide
Linkedin Conversion API with Server-side GTM (sGTM)

Linkedin Conversions API (CAPI) for Server-Side Google Tag Manager (sGTM)

In this article

  1. Prerequisites (opens in a new tab)
  2. Configuration Steps (opens in a new tab)

The LinkedIn Conversions API Tag template directly connects marketing data from an advertiser’s server-side or client-side 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 Hardal 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 your server, Hardal) where an event tag makes the API call to LinkedIn.

The LinkedIn Conversions API Tag template (opens in a new tab) is developed and maintained by LinkedIn following the Google Custom Tag Template (opens in a new tab). 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 Hardal)
  • How to configure your GTM server container for the data to be passed to LinkedIn’s Conversions API endpoint

(opens in a new tab)

Prerequisites

  1. Review the LinkedIn’s Conversion API product, see here (opens in a new tab).
  2. Review Google’s Introduction to Server-Side Tagging (opens in a new tab) and Custom Tag Templates (opens in a new tab)
  3. Have GA4 conversion events configured and tracked on your website
  4. Have a GTM account (opens in a new tab) and web container (opens in a new tab) up and running
  5. Generate a LinkedIn API access token as outlined here (opens in a new tab).

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.

(opens in a new tab)

Configuration Steps

(opens in a new tab)

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 (opens in a new tab).
  • Server container: Create a server container within your GTM account to set up a tagging server URL. For more information, see here (opens in a new tab) to complete this step.

Starting up a server container requires configuring a tagging server. Hardal offers a default deployment that can be completed when setting up the server container.

You can create a new container here

Configure Your Web and Server Containers

  1. To configure web container, create the following:
    1. Google Tag where you will configure the server_container_url.
    2. GA4 Event tag where you will configure the event schema for the conversion event that will be passed to the server_container and on to LinkedIn.
  2. To configure server container, create the following:
    1. GA4 Client that will listen for the GA4 conversion event.
    2. LinkedIn | CAPI Tag, based on the template (opens in a new tab), 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.

(opens in a new tab)

1. Web Container Setup

(opens in a new tab)

‘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 (opens in a new tab).

  1. To set up a new ‘Google Tag’, see here (opens in a new tab).

  2. After creating a new Google Tag, you need to set the Tag ID and add a Configuration Parameter under the Configuration Settings.

     Note

    • The Configuration Parameter field should be set to server_container_url and the Value field set to the Server 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.

(opens in a new tab)

GA4 Event Tag - Create a Conversion Event Tag

If you do not have a GA4 Event tag already set up, perform the following steps:

  1. Navigate to Tags > New > Template Gallery and select a new ‘GA4 Event’ tag.
  2. 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 (opens in a new tab)’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 (opens in a new tab). 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 (opens in a new tab). 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.

Web container, event configuration

 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.

Expand table

Linkedin Conversions API ParameterGA4 Field NameGTM Data Layer Variable NameRequired
ConversionUrn conversionconversion_rule_ideventModel.conversion_rule_idrequired
Conversion Event Time conversionHappenedAtconversion_happened_ateventModel.conversion_happened_atrequired
Event Id eventIdevent_ideventModel.event_idoptional
Sha256 Hashed Email SHA256_EMAILuser_data.sha256_email_addresseventModel.user_data.sha256_email_address*1 of these IDs is required
LINKEDIN_FIRST_PARTY_ADS_UUID LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUIDuser_data.linkedinFirstPartyIdeventModel.user_data.linkedinFirstPartyId*1 of these IDs is required
Acxiom ID ACXIOM_IDuser_data.acxiomIDeventModel.user_data.acxiomID*1 of these IDs is required
Moat ID ORACLE_MOAT_IDuser_data.moatIDeventModel.user_data.moatID*1 of these IDs is required
First Name firstNameuser_data.address.first_nameeventModel.user_data.address.first_nameoptional
Last Name lastNameuser_data.address.last_nameeventModel.user_data.address.last_nameoptional
Country Code countryCodeuser_data.address.countryeventModel.address.countryoptional
Company Name companyNameuser_data.companyNameeventModel.user_data.companyNameoptional
Job Title titleuser_data.titleeventModel.user_data.titleoptional
conversionValue conversionValueuser_data.currency and user_data.valueeventModel.user_data.currency, eventModel.user_data.valueoptional

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:

  1. Install the ‘LinkedIn | CAPI Tag’ from the Community Template Gallery.
  2. Navigate to Tags > New > Edit > Community Template Gallery and select ‘LinkedIn | CAPI Tag’.
  • 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.
  1. To install this tag, you will need the conversion rule ID and a LinkedIn API access token. See OAuth Token Generation documentation here (opens in a new tab) and Postman Getting Started guide here (opens in a new tab). Click here (opens in a new tab) to generate an access token now.

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 (opens in a new tab), which is available on both the web container and the server container.