LinkedIn Insight Tag and Conversions API | OpsBlu Docs

LinkedIn Insight Tag and Conversions API

Implement LinkedIn Insight Tag tracking and Conversions API. Covers conversion tracking, matched audiences, first-party data segments, and offline...

How LinkedIn Ads Tracking Works

LinkedIn Ads conversion tracking relies on two systems:

  1. LinkedIn Insight Tag -- A lightweight JavaScript snippet (~80 KB) that loads on every page. It sets a first-party _li_fat_id cookie and a third-party li_fat_id cookie on the linkedin.com domain. The tag fires page view events and enables conversion tracking, retargeting, and website demographics.
  2. Conversions API (CAPI) -- A server-side endpoint where your backend sends conversion events directly to LinkedIn. Supplements the Insight Tag for environments where browser tracking is unreliable.

The data flow: a user clicks a LinkedIn ad with a li_fat_id parameter (LinkedIn first-party ad tracking ID) appended to the URL. The Insight Tag reads this parameter and stores it as a cookie. When the user later triggers a conversion event (form submission, purchase), the tag sends the event with the tracking ID back to LinkedIn. LinkedIn matches the conversion to the original ad click for attribution.

LinkedIn also collects a member identifier through the third-party cookie when the user is signed into LinkedIn in the same browser. This enables website demographics reporting (showing which companies, job functions, and industries visit your site) even without click-based attribution.


Installing the Insight Tag

Direct Installation

Place this snippet before the closing </body> tag on every page. Replace YOUR_PARTNER_ID with your LinkedIn partner ID (found in Campaign Manager under Account Assets > Insight Tag).

<script type="text/javascript">
_linkedin_partner_id = "YOUR_PARTNER_ID";
window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
window._linkedin_data_partner_ids.push(_linkedin_partner_id);
</script>
<script type="text/javascript">
(function(l) {
  if (!l){window.lintrk = function(a,b){window.lintrk.q.push([a,b])};
  window.lintrk.q=[]}
  var s = document.getElementsByTagName("script")[0];
  var b = document.createElement("script");
  b.type = "text/javascript";b.async = true;
  b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
  s.parentNode.insertBefore(b, s);
})(window.lintrk);
</script>
<noscript>
<img height="1" width="1" style="display:none;" alt=""
  src="https://px.ads.linkedin.com/collect/?pid=YOUR_PARTNER_ID&fmt=gif" />
</noscript>

GTM Installation

In Google Tag Manager:

  1. Create a new Custom HTML tag.
  2. Paste the Insight Tag code.
  3. Set the trigger to All Pages.
  4. Publish the container.

LinkedIn also offers a native GTM template in the Community Template Gallery. Search for "LinkedIn Insight Tag" and configure with your partner ID.

Verifying Installation

After installing, verify in Campaign Manager under Analyze > Insight Tag. The status should show "Active" within 24 hours. You can also check with LinkedIn's Tag Helper Chrome extension or by inspecting network requests for px.ads.linkedin.com.


Conversion Tracking

Setting Up Conversions in Campaign Manager

  1. Go to Analyze > Conversion tracking.
  2. Click Create conversion.
  3. Choose a conversion type: Online, Offline, or Event-specific.
  4. Configure the trigger:
    • Page load -- Fires when a user visits a specific URL (e.g., /thank-you).
    • Event-specific -- Fires on a JavaScript event call using the Insight Tag API.

URL-Based Conversions

The simplest method. Define a URL pattern (exact match, starts with, or contains) that indicates a conversion:

  • Exact: https://example.com/thank-you
  • Starts with: https://example.com/confirmation
  • Contains: /success

No additional code required beyond the Insight Tag on every page.

Event-Specific Conversions

For dynamic events (form submissions, button clicks, AJAX completions), fire a conversion event with JavaScript:

window.lintrk('track', { conversion_id: 12345678 });

The conversion_id is assigned when you create the conversion action in Campaign Manager. You can pass it as a number or string.

Tracking Purchases with Value

LinkedIn supports conversion value tracking:

window.lintrk('track', {
  conversion_id: 12345678,
  value: 299.99,
  currency: 'USD'
});

Conversion Windows

LinkedIn Ads attribution defaults:

  • Click-through: 30 days (configurable: 1, 7, 30, or 90 days)
  • View-through: 7 days (configurable: 1, 7, 30, or 90 days)

The conversion window applies from the time of the click or impression. LinkedIn uses last-touch attribution by default.


Conversions API (Server-Side)

LinkedIn's CAPI sends conversion events from your server, bypassing browser-side limitations. It supplements (not replaces) the Insight Tag.

API Endpoint

POST https://api.linkedin.com/rest/conversionEvents

Authentication

CAPI requires an OAuth 2.0 access token with the r_ads_reporting and rw_conversions scopes. Generate a token through a LinkedIn app with the Marketing Developer Platform product approved.

Event Payload

curl -X POST "https://api.linkedin.com/rest/conversionEvents" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "LinkedIn-Version: 202401" \
  -d '{
    "conversion": "urn:lla:llaPartnerConversion:12345678",
    "conversionHappenedAt": 1709312400000,
    "conversionValue": {
      "currencyCode": "USD",
      "amount": "299.99"
    },
    "eventId": "unique-event-id-abc123",
    "user": {
      "userIds": [
        {
          "idType": "SHA256_EMAIL",
          "idValue": "309a0a5c3e211326ae75ca18196d301a9bdda1a04f06e4d4e92c99d13a5e5a0e"
        }
      ],
      "userInfo": {
        "firstName": "John",
        "lastName": "Doe",
        "companyName": "Acme Corp",
        "title": "VP Engineering",
        "countryCode": "US"
      }
    }
  }'

Key Fields

Field Required Description
conversion Yes URN of the conversion rule from Campaign Manager
conversionHappenedAt Yes Unix timestamp in milliseconds
eventId Recommended For deduplication between Insight Tag and CAPI
user.userIds Yes Array of identifiers (SHA256_EMAIL, SHA256_PHONE, LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID, ACXIOM_ID, ORACLE_MOAT_ID)
user.userInfo Optional Plaintext user metadata to improve match rate
conversionValue Optional Transaction value and currency code

Hashing

Hash email and phone with SHA-256 before sending. Email must be lowercase and trimmed. Phone must include country code with no separators.

const crypto = require('crypto');
const hashedEmail = crypto.createHash('sha256')
  .update('user@example.com'.trim().toLowerCase())
  .digest('hex');

Capturing li_fat_id for CAPI

The LinkedIn first-party ad tracking ID is passed in the URL parameter li_fat_id on ad clicks. Capture and store it:

function captureLiFatId() {
  const params = new URLSearchParams(window.location.search);
  const liFatId = params.get('li_fat_id');
  if (liFatId) {
    document.cookie = `_li_fat_id=${liFatId};max-age=7776000;path=/;SameSite=Lax`;
  }
  return liFatId;
}
captureLiFatId();

Pass this as a LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID in the userIds array for CAPI calls.


Matched Audiences and Retargeting

Website Retargeting

The Insight Tag automatically enables website retargeting. Create audiences in Campaign Manager under Plan > Audiences:

  • All website visitors in the last N days (1-180)
  • Specific page visitors -- URL equals, starts with, or contains a pattern
  • Event-based -- Users who triggered a specific conversion event

Audiences require a minimum of 300 members to be used for targeting.

Contact List Targeting

Upload a list of emails or company names for targeting:

  1. Go to Plan > Audiences > Create audience > Contact list.
  2. Upload a CSV with columns: email, first name, last name, company, job title, country.
  3. LinkedIn hashes and matches against member profiles.
  4. Match rates typically range from 30-60% depending on data quality.

Company List Targeting (ABM)

Upload a CSV of company names or domains:

CompanyName,CompanyDomain,CompanyIndustry,CompanyCountry
Acme Corp,acme.com,Technology,US
Globex Inc,globex.io,Manufacturing,US

LinkedIn matches against its company database. This enables account-based marketing where you target all employees (or specific roles) at named companies.

Lookalike Audiences

Create lookalike audiences from any source audience (website visitors, contact lists, or engagement). LinkedIn finds members with similar professional attributes. Select a country and let LinkedIn's algorithm determine the optimal audience size.

Predictive Audiences

LinkedIn's predictive audiences use AI to find members likely to convert based on your conversion data and profile signals. Requires at least 30 conversions in the past 30 days.


Common Issues

Issue Cause Fix
Insight Tag showing "Unverified" Tag not loading on any page, or loading behind consent wall with no interactions Visit a page with the tag while signed into Campaign Manager. Check that the snap.licdn.com script loads in the network tab.
No conversions recording Conversion trigger misconfigured, or URL pattern not matching For URL-based conversions, verify the URL pattern exactly matches (watch for trailing slashes, query parameters). For event-based, confirm lintrk('track', {...}) fires in the console.
Website Demographics showing no data Third-party cookies blocked Website demographics rely on LinkedIn's third-party cookie. Safari and Firefox block these by default. Data will only show for Chrome users not blocking third-party cookies.
Low match rate on contact list Email format inconsistent, using personal emails vs. work emails LinkedIn matches on work email addresses associated with profiles. Personal Gmail/Yahoo addresses match at much lower rates. Clean data before upload.
CAPI 403 error OAuth token missing required scopes or expired Verify token has r_ads_reporting and rw_conversions scopes. Refresh the token if expired (tokens expire after 60 days).
Duplicate conversions Insight Tag and CAPI both firing without deduplication Include the same eventId in both the lintrk('track', ...) call and the CAPI payload.
li_fat_id not in URL User reached site through organic LinkedIn or direct navigation The li_fat_id parameter is only appended on paid ad clicks. Organic LinkedIn traffic does not include it. Use email matching as fallback.
Audience too small to serve Fewer than 300 matched members Broaden URL patterns for website audiences. For contact lists, upload more contacts or combine multiple lists.

LinkedIn-Specific Considerations

Revenue Attribution Reporting

LinkedIn offers Revenue Attribution Reports that connect CRM data to ad interactions. The integration works with Salesforce, HubSpot, and Microsoft Dynamics:

  1. Connect your CRM in Campaign Manager under Analyze > Revenue Attribution.
  2. LinkedIn matches CRM contacts to LinkedIn members via email.
  3. Reports show which campaigns influenced pipeline and closed-won revenue.

This requires a CRM integration setup and typically 30-90 days of data accumulation.

Document Ads and Lead Gen Forms

Lead Gen Forms are pre-filled forms served within the LinkedIn app -- the user never leaves LinkedIn. Leads are captured in Campaign Manager and can be synced to your CRM via Zapier, native integrations, or the Marketing API.

Lead Gen Form submissions do NOT trigger Insight Tag events (the user never visits your website). Track these separately through the Campaign Manager UI or the leads API endpoint:

GET https://api.linkedin.com/rest/adFormResponses?q=account&account=urn:li:sponsoredAccount:YOUR_ACCOUNT_ID

For GDPR compliance, do not load the Insight Tag until consent is granted. Use a consent management platform to conditionally load the script. LinkedIn does not currently offer a built-in consent mode like Google's -- the tag either loads or it does not.

For CCPA, LinkedIn's DPA covers data processing. You can configure ad account settings to restrict data use for California residents.

IP Exclusions and Blocklists

Block traffic from specific companies or IPs by adding them to the campaign exclusion list. This prevents wasting spend on employees of your own company or known non-target accounts.