Install LinkedIn Insight Tag: Conversions and CAPI | OpsBlu Docs

Install LinkedIn Insight Tag: Conversions and CAPI

Full LinkedIn Insight Tag setup guide covering installation, event-specific conversions, CAPI integration, retargeting audiences, and testing.

What the LinkedIn Insight Tag Does

The LinkedIn Insight Tag is a lightweight JavaScript snippet that enables conversion tracking, website audience retargeting, and demographic reporting for LinkedIn ad campaigns. It sends page view data to LinkedIn, and you layer event-specific conversion tracking on top for actions like form submissions and purchases.

Install the Base Tag

Get your Partner ID from LinkedIn Campaign Manager under Account Assets > Insight Tag. Place the snippet before the closing </body> tag on every page:

<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);
(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>

The base tag automatically tracks page views. No additional configuration is needed for pageview-level data.

Event-Specific Conversion Tracking

LinkedIn supports two methods for defining conversions: URL-based rules (configured entirely in Campaign Manager) and event-specific triggers (fired from your site code).

URL-Based Conversions

In Campaign Manager, go to Analyze > Conversion Tracking > Create Conversion. Choose "Online conversion," select a conversion type (Lead, Purchase, Sign Up, etc.), and define a URL rule like "Page URL contains /thank-you." No code changes required.

Event-Specific Pixel Conversions

For actions that do not result in a new page load (single-page apps, AJAX forms), fire the conversion from JavaScript:

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

The conversion_id comes from Campaign Manager after you create a conversion and choose the "event-specific" tracking method. Fire this call in the callback of whatever action you want to track.

Example on a form submission:

document.getElementById('contact-form').addEventListener('submit', function() {
  window.lintrk('track', { conversion_id: 12345678 });
});

Standard Conversion Types

When creating a conversion in Campaign Manager, you select from these types:

Type Use Case
Add to Cart Ecommerce cart additions
Download Whitepaper, PDF, or file downloads
Install App installs
Key Page View High-intent page visits (pricing, demo)
Lead Form submissions, gated content
Purchase Completed transactions
Sign Up Account registration
Other Custom actions that do not fit above

Choose the type that best matches the action. LinkedIn uses this classification to optimize ad delivery when you select conversion-based bidding.

LinkedIn Conversions API (CAPI)

LinkedIn CAPI lets you send conversion events server-to-server, improving data reliability when browsers block third-party scripts. It complements the Insight Tag rather than replacing it.

Setup steps:

  1. In Campaign Manager, go to Account Assets > Conversions API.
  2. Generate an API access token with the r_conversions scope.
  3. Send events via POST request:
curl -X POST \
  "https://api.linkedin.com/rest/conversionEvents" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "LinkedIn-Version: 202403" \
  -H "Content-Type: application/json" \
  -d '{
    "conversion": "urn:lla:llaPartnerConversion:12345678",
    "conversionHappenedAt": 1709568000000,
    "user": {
      "userIds": [{
        "idType": "SHA256_EMAIL",
        "idValue": "309a0a5c3e211326ae75ca18196d301a9bdbd1a882a4d2569511033da23f0abd"
      }],
      "userInfo": {
        "firstName": "Jane",
        "lastName": "Smith",
        "companyName": "Acme Corp"
      }
    },
    "eventId": "evt-abc-123"
  }'

Hash email addresses with SHA-256 before sending. Include eventId for deduplication if you also fire the same conversion via the browser pixel.

Retargeting Audience Setup

The Insight Tag enables website retargeting without any extra code:

  1. In Campaign Manager, go to Plan > Audiences > Create Audience > Retargeting > Website.
  2. Define the audience using URL rules (e.g., "visited any page," "visited pages containing /pricing," "visited pages containing /blog").
  3. Set the lookback window (30, 60, 90, 180, or 365 days).
  4. Audiences need at least 300 matched LinkedIn members before they can be used in campaigns.

You can create multiple audiences with different URL rules and layer them for exclusion targeting (e.g., target pricing visitors but exclude those who already converted).

Website Demographics

Once the Insight Tag has collected enough data, the Website Demographics report (under Analyze > Website Demographics) shows aggregate professional attributes of your visitors: job title, industry, company size, seniority, function, and location. This data comes from matching visitor cookies to LinkedIn profiles. No PII is exposed -- you see aggregate counts only.

Testing and Validation

LinkedIn Insight Tag Helper

Install the LinkedIn Insight Tag Helper Chrome extension. It verifies that the tag is present, loading correctly, and associated with the right Partner ID. The extension flags issues like missing tags, duplicate installations, or JavaScript errors.

Campaign Manager Diagnostics

In Account Assets > Insight Tag, Campaign Manager shows tag status per domain: active (firing within the last 7 days), inactive, or not verified. If the tag shows inactive, check for JavaScript errors in the browser console or conflicting Content Security Policy headers.

Test Conversions

After setting up event-specific conversions, trigger the event on your site and check the conversion detail page in Campaign Manager. Events typically appear within a few hours. CAPI events show immediately in the API response but may take up to 24 hours to appear in reporting.

Common Pitfalls

  • Content Security Policy blocks -- if your CSP does not allow snap.licdn.com, the tag will silently fail. Add snap.licdn.com and px.ads.linkedin.com to your script-src and img-src directives.
  • Single-page app navigation -- the base tag only fires on initial page load. For SPA route changes, call window.lintrk('track') manually on each virtual page view, or rely on event-specific conversions.
  • Audience size too small -- LinkedIn requires 300 matched members minimum. For low-traffic sites, use broader URL rules and longer lookback windows to build audiences faster.