LinkedIn¶
This guide shows you how to set up LinkedIn Conversion API using server-side Google Tag Manager.
Prerequisites¶
Before you begin the implementation, ensure you have the following in place:
-
LinkedIn Campaign Manager: You need Account Manager, Campaign Manager, Creative Manager, or Account Billing Admin access to at least one LinkedIn Campaign Manager Ads account.
-
Conversion Rule ID and Access Token for the LinkedIn Conversion API, which can be obtained in the LinkedIn Campaign Manager.
-
Server-side GTM container: A server-side GTM container provisioned by Usercentrics, available via a first-party endpoint, and configured to process GA4 events. Read our Getting started page to learn how to set up a server-side GTM provided by Usercentrics, and learn how to share access to a GTM container in this Google Support article.
Benefits of Server-Side Tagging with LinkedIn CAPI¶
-
Improved Website Performance: By reducing the number of JavaScript code snippets that need to be loaded on your website, server-side tagging can help to avoid slowing down your site's performance.
-
Resilience to Cookie Deprecation: This solution is not impacted by the deprecation of third-party cookies in browsers like Google Chrome, making it a more future-proof approach to conversion tracking.
-
Enhanced Data Control and Security: Server-side tagging gives you complete control over the data shared with each CAPI destination. You can centralize your tag control and decide precisely what information is sent.
-
Increased Efficiency and Speed: This method streamlines the deployment of marketing and analytics tags, reducing the time required for code changes.
Rollout plan¶
A quick overview of the setup is as follows:
-
Step 1: Create a Conversion Rule and Access Token in LinkedIn Campaign Manager. Optionally, record the Conversion Rule ID.
-
Step 2: In the GTM server container, the LinkedIn CAPI tag template is installed and configured with the Access Token and Conversion Rule ID. The container is then published.
-
Step 3: With Preview enabled for GTM Web and GTM Server, a test conversion confirms an HTTP 201 in both containers. The rule shows Active in Campaign Manager.
These steps are explained in the following sections in more detail.
Step 1: Get the LinkedIn API Access Token, Conversion Rule ID and Unique Event ID¶
First you must gather the necessary identifiers from LinkedIn Campaign Manager: the API Access Token for authentication, the Conversion Rule ID for event mapping, and the Unique Event ID for event deduplication if the client-side Insight Tag is also in use.
-
LinkedIn API Access Token:
Generate it in your Campaign Manager under Measurement - Insights - Manage Sources - Google Tag Manager.
-
Conversion Rule ID:
For specific conversion events (e.g.,
purchase
), you'll need the ID of the conversion rule you create in Campaign Manager under Measurement - Conversion Tracking. This ID is often found in the URL when viewing the conversion rule's details. -
Unique Event ID for deduplication (optional):
If you are running the LinkedIn Insight Tag client-side in addition to server-side, send a unique event ID with both. This lets LinkedIn deduplicate the conversion. For deduplication to work, every event must have a unique ID that is identical for both the browser and server event.
-
In your client-side Google Tag Manager, in the web GTM container, go to Variables - New.
-
Choose Custom JavaScript Variable and paste the following code:
function() { var timestamp = new Date().getTime(); var randomNumber = Math.random().toString(36).substring(2); return 'evt_' + timestamp + '_' + randomNumber; }
-
Name this variable
CJS - Unique Event ID
. -
Add Event ID to GA4 Event Tags:
Add a parameterevent_id
and insert the {{CJS - Unique Event ID}} variable as a value on each GA4 event. -
Set up the LinkedIn InsightTag 2.0:
-
In your Web GTM container, go to Tags - New.
-
Click Tag Configuration and in the Community Template Gallery find the LinkedIn InsightTag 2.0 tag template.
-
Enter your Partner ID/ Insight Tag ID and your Conversion Rule ID. It's best practice to store those in a Constant variable.
-
Insert the {{CJS - Unique Event ID}} variable in the Event ID field.
-
Set the trigger to All Pages.
-
-
Step 2: Set up Google Tag Manager (GTM) server container¶
This step involves deploying and configuring the LinkedIn CAPI Tag within your Google Tag Manager server container, which will receive the data from your website and forward it to LinkedIn.
-
Install and Configure LinkedIn CAPI Tag:
-
Install LinkedIn CAPI Tag Template: In your GTM server container, access the Community Template Gallery and install the "LinkedIn | CAPI Tag Template".
-
Configure the CAPI Tag: Set up the new tag using the following two values you recorded:
-
The GTM Access Token from Step 1.
-
The specific Conversion rule ID from Step 1.
-
-
Optional: Add the unique EventID or the Conversion Value, by adding the respective variable to the fields.
-
Optional: Override User Ids, User Ids Info and Event Data, by adding Property Name and Property Value in the respective drop-down-menu.
-
-
Publish server changes:
Once the tag is fully configured, publish the changes within your GTM server container environment. This makes the LinkedIn CAPI tag active and ready to process incoming data streams.
Step 3: End-to-end verification and testing¶
This crucial final step verifies that data is flowing correctly from the client, through the GTM server, and successfully reaching the LinkedIn platform.
-
Activate Preview modes and test:
-
Begin testing by simultaneously activating the "Preview" mode in your server GTM container.
-
Visit your website and perform a test conversion (e.g., submitting the form) that is designed to trigger the new tags.
-
-
Verify data flow in the server container, in the Tag Assistant.
-
Confirm that the LinkedIn CAPI Tag fires successfully.
-
Verify that the server has received a "201" response code from the LinkedIn API, which indicates a successful, accepted conversion transmission.
-
-
Check the conversion rule status in Campaign Manager:
Return to LinkedIn Campaign Manager. The status of your CAPI conversion rule should now have changed to "Active", officially confirming that the end-to-end data flow is complete and successful.