LinkedIn Ads
How to set up tracking for LinkedIn Ads through the LinkedIn Conversions API
The LinkedIn Conversions API sends event data straight from your server to LinkedIn instead of from the visitor's browser. That means less data lost to browser restrictions, adblockers and privacy settings, and a more accurate picture of what your LinkedIn Ads are actually delivering. It supports the events that matter most: page views, purchases and form submissions.
How the setup fits together
There are four parts to this setup, and the order matters because each one produces something the next needs:
In LinkedIn Campaign Manager, create a conversion and generate an access token.
In your GTM web container, capture the
li_fat_idcookie and pass it along with your GA4 events.In your GTM server container, add the LinkedIn template and read
li_fat_idback out of the incoming event data.Still in the server container, build a page view tag and one conversion tag per action you want to measure.
1. Create the conversion in LinkedIn Campaign Manager
You need two values from LinkedIn: a conversion rule ID and an access token.
Let's start by creating a new conversion.
Log in to the correct account in the LinkedIn Campaign Manager.
In the left menu, go to Measure → Conversion tracking.

Click Create conversion → Conversions API.

Fill in the settings:
Name — something you'll recognise later, such as Purchase or Lead
Category — pick the category that matches the action
Value — optional
Continue to the next step and select Direct API as the data source.
Continue again and create the conversion.
Reopen the conversion you just created and look at the browser address bar. The conversion rule ID is the number in the URL after
/conversions/.

Capture li_fat_id in the web container
li_fat_id is LinkedIn's first-party ad tracking ID. It's written as a cookie when someone clicks a LinkedIn ad, and it's what allows LinkedIn to connect a server-side conversion back to that click.
Open your GTM web container and go to Variables.
Under User-Defined Variables, create a new variable.
Choose 1st-Party Cookie as the variable type.
Enter
li_fat_idas the cookie name.Name the variable
Cookie - li_fat_idand save.

Open your Google Tag on the GTM web container.
Expand Configuration parameters, add a parameter with the name
li_fat_idand the value{{Cookie - li_fat_id}}.

Save the Google Tag.
Open the GTM server container.
Create a new Event Data variable in your server container with
li_fat_idas the key.

Add the LinkedIn template to the server container
Open your GTM server container and click Templates.
Under Tag Templates, click Search Gallery.
Search for LinkedIn Conversion API, select it, and add it to your workspace.

The LinkedIn integration expects a page view tag alongside your conversions, so set this one up before the conversion tags.
Create a new tag in your server container.
Choose LinkedIn Conversion API as the tag configuration.
Set Event Type to Page View.
Attach the All Pages trigger and save.

Set up conversion tags
Create a new tag and choose LinkedIn Conversion API as the tag configuration.
Configure it:
Event Type — Conversion
Access Token — your constant variable holding the API token
Conversion Rule ID — the ID from the URL in step 1
For User IDs, add an override:
Key:
LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUIDValue: your
li_fat_idEvent Data variable
Attach a trigger that fires when the relevant GA4 event reaches your server container. For example:
Purchase conversion →
event_nameequalspurchaseLead conversion →
event_nameequalsgenerate_lead
Save the tag.

Test the tags
Run the server container in preview mode and trigger the event on your site. Three things to confirm:
The LinkedIn conversion tag fires on the right event, and only on that event.
{ED - li_fat_id}}resolves to a value rather thanundefined. If it's empty, arrive at your site through an actual LinkedIn ad click first, the cookie won't exist otherwise, and a missing cookie looks identical to a broken variable.The outgoing request returns a success response. An authentication error here almost always means the token or the conversion rule ID went in wrong.
Last updated
Was this helpful?



