For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

  1. In LinkedIn Campaign Manager, create a conversion and generate an access token.

  2. In your GTM web container, capture the li_fat_id cookie and pass it along with your GA4 events.

  3. In your GTM server container, add the LinkedIn template and read li_fat_id back out of the incoming event data.

  4. Still in the server container, build a page view tag and one conversion tag per action you want to measure.


1

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.

  1. Log in to the correct account in the LinkedIn Campaign Manager.

  2. In the left menu, go to Measure → Conversion tracking.

  1. Click Create conversion → Conversions API.

  1. 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

  1. Continue to the next step and select Direct API as the data source.

  2. Continue again and create the conversion.

  3. 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/.

2

Generate the API Token

  1. In Campaign Manager, go to Signals manager under Data.

  1. Open the Direct API source.

  1. Click Generate access token.

  2. Copy the token.

  3. Store this API token in a constant variable in your GTM server container.

3

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.

  1. Open your GTM web container and go to Variables.

  2. Under User-Defined Variables, create a new variable.

  3. Choose 1st-Party Cookie as the variable type.

  4. Enter li_fat_id as the cookie name.

  5. Name the variable Cookie - li_fat_id and save.

  1. Open your Google Tag on the GTM web container.

  2. Expand Configuration parameters, add a parameter with the name li_fat_id and the value {{Cookie - li_fat_id}}.

  1. Save the Google Tag.

  2. Open the GTM server container.

  3. Create a new Event Data variable in your server container with li_fat_id as the key.

4

Add the LinkedIn template to the server container

  1. Open your GTM server container and click Templates.

  2. Under Tag Templates, click Search Gallery.

  3. 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.

  1. Create a new tag in your server container.

  2. Choose LinkedIn Conversion API as the tag configuration.

  3. Set Event Type to Page View.

  4. Attach the All Pages trigger and save.

5

Set up conversion tags

  1. Create a new tag and choose LinkedIn Conversion API as the tag configuration.

  2. 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

  3. For User IDs, add an override:

    • Key: LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID

    • Value: your li_fat_id Event Data variable

  4. Attach a trigger that fires when the relevant GA4 event reaches your server container. For example:

    • Purchase conversion → event_name equals purchase

    • Lead conversion → event_name equals generate_lead

  5. Save the tag.

6

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 than undefined. 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.

Conversions won't appear in Campaign Manager instantly, so don't treat an empty report in the first few minutes as a failure.

Last updated

Was this helpful?