LinkedIn Ads Event Tracking: Setup Guide | OpsBlu Docs

LinkedIn Ads Event Tracking: Setup Guide

Implement LinkedIn Ads conversion events for lead tracking, ROI measurement, and campaign attribution with the Insight Tag.

Overview

LinkedIn event tracking enables measurement of user actions after ad exposure. This powers conversion-based optimization, ROI calculation, and campaign attribution. Proper event tracking is essential for understanding campaign impact and optimizing performance.


Prerequisites

Before implementing conversion tracking:

  1. Insight Tag Installed - Base tag must be on all pages
  2. Conversion Created - Define conversion in Campaign Manager
  3. Access to Website Code - Ability to add tracking code to conversion pages
  4. Testing Environment - Staging site for verification

Creating Conversions in Campaign Manager

Step 1: Access Conversions

  1. Log in to LinkedIn Campaign Manager
  2. Navigate to Account Assets
  3. Select Conversions
  4. Click Create Conversion

Step 2: Configure Conversion

Basic Information:

Name

  • Descriptive label (e.g., "Demo Request", "Trial Signup")
  • Internal reference only (not visible to users)

Type Choose from standard options:

  • Apply
  • Contact
  • Download
  • Install
  • Key Page View
  • Lead
  • Purchase
  • Sign Up
  • Subscribe
  • Add to Cart
  • Other

Value

  • Static Value: Fixed amount per conversion
  • Dynamic Value: Pass actual transaction value
  • No Value: Count conversions without value

Example Values:

  • Lead: $50 (average lead value)
  • Purchase: Dynamic (actual order total)
  • Download: $0 (count only)

Step 3: Attribution Settings

Click-Through Attribution Window

  • 1, 7, 30, or 90 days
  • Default: 30 days
  • How long after click to attribute conversion

View-Through Attribution Window

  • 1, 7, or 30 days
  • Default: 7 days
  • How long after impression to attribute conversion

Counting Method

  • One per click: Only first conversion counts (recommended for leads/signups)
  • Many per click: Multiple conversions count (for ecommerce repeat purchases)

Step 4: Get Conversion ID

After creating conversion:

  1. Note the Conversion ID (numeric)
  2. Copy tracking code snippet provided
  3. Save conversion

Basic Conversion Tracking

Standard Implementation

Place on conversion confirmation page (thank-you page, order confirmation, etc.):

<!-- LinkedIn Conversion Tracking -->
<script type="text/javascript">
window.lintrk('track', { conversion_id: YOUR_CONVERSION_ID });
</script>

Example for Trial Signup:

<!DOCTYPE html>
<html>
<head>
  <title>Thank You - Trial Started</title>

  <!-- LinkedIn Insight Tag (should already be on all pages) -->
  <script type="text/javascript">
  _linkedin_partner_id = "1234567";
  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>
</head>
<body>
  <h1>Thank you for starting your trial!</h1>

  <!-- Conversion Tracking for Trial Signup -->
  <script type="text/javascript">
  window.lintrk('track', { conversion_id: 5678901 });
  </script>
</body>
</html>

Dynamic Value Tracking

Passing Transaction Value

For purchases or variable-value conversions:

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

E-commerce Purchase Example

<script type="text/javascript">
// Get order total from your system
var orderTotal = 249.99; // Example: from server-side variable

window.lintrk('track', {
  conversion_id: 1234567, // Your Purchase conversion ID
  value: orderTotal,
  currency: 'USD'
});
</script>

Dynamic Implementation with Server Variables

PHP Example:

<script type="text/javascript">
window.lintrk('track', {
  conversion_id: 1234567,
  value: <?php echo $order_total; ?>,
  currency: 'USD'
});
</script>

JavaScript/Template Example:

<script type="text/javascript">
window.lintrk('track', {
  conversion_id: 1234567,
  value: {{ order.total }}, // Template variable
  currency: 'USD'
});
</script>

Supported Currencies

Use ISO 4217 currency codes:

  • USD, EUR, GBP, CAD, AUD
  • JPY, CNY, INR, BRL, etc.
  • Full list: ISO 4217 codes

Google Tag Manager Implementation

Creating Conversion Tag in GTM

Step 1: Create Tag

  1. GTM > Tags > New
  2. Name: "LinkedIn Conversion - [Conversion Name]"
  3. Tag Type: Custom HTML

Step 2: Add Code

<script type="text/javascript">
window.lintrk('track', { conversion_id: YOUR_CONVERSION_ID });
</script>

Step 3: Configure Trigger

Create trigger based on conversion event:

Option A: Page View Trigger

  • Trigger Type: Page View
  • This trigger fires on: Some Page Views
  • Page URL contains: /thank-you
  • Or Page Path equals: /order-confirmation

Option B: Custom Event Trigger

  • Trigger Type: Custom Event
  • Event Name: formSubmission or purchase
  • Fires when your form/checkout fires custom event

Step 4: Test and Publish

  1. Enable Preview mode
  2. Complete conversion action
  3. Verify tag fires in debugger
  4. Check Network tab for request
  5. Publish container

GTM with Dynamic Values

Step 1: Create Variables

Data Layer Variables:

  • Variable Name: DL - Order Total

  • Data Layer Variable Name: orderTotal

  • Variable Name: DL - Currency

  • Data Layer Variable Name: currency

Step 2: Update Tag Code

<script type="text/javascript">
window.lintrk('track', {
  conversion_id: 1234567,
  value: {{DL - Order Total}},
  currency: '{{DL - Currency}}'
});
</script>

Step 3: Push to Data Layer

On confirmation page:

<script>
dataLayer.push({
  'event': 'purchase',
  'orderTotal': 249.99,
  'currency': 'USD'
});
</script>

Multiple Conversions

Tracking Different Conversion Types

Create separate conversions for different actions:

Demo Request (Conversion ID: 1111111):

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

Trial Signup (Conversion ID: 2222222):

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

Purchase (Conversion ID: 3333333):

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

Conditional Tracking Based on Action

// Determine which conversion occurred
var conversionType = getConversionType(); // Your function

if (conversionType === 'demo') {
  window.lintrk('track', { conversion_id: 1111111 });
} else if (conversionType === 'trial') {
  window.lintrk('track', { conversion_id: 2222222 });
} else if (conversionType === 'purchase') {
  window.lintrk('track', {
    conversion_id: 3333333,
    value: getOrderTotal(),
    currency: 'USD'
  });
}

Advanced Tracking Scenarios

Single Page Applications (SPAs)

For React, Vue, Angular apps where pages don't reload:

// Track conversion on route change or form submission
function trackLinkedInConversion(conversionId, value = null) {
  if (typeof window.lintrk === 'function') {
    const conversionData = { conversion_id: conversionId };

    if (value !== null) {
      conversionData.value = value;
      conversionData.currency = 'USD';
    }

    window.lintrk('track', conversionData);
  }
}

// Call when conversion occurs
trackLinkedInConversion(1234567);

// Or with value
trackLinkedInConversion(3333333, 99.99);

React Example:

import { useEffect } from 'react';

function ThankYouPage() {
  useEffect(() => {
    // Track conversion when component mounts
    if (typeof window.lintrk === 'function') {
      window.lintrk('track', { conversion_id: 1234567 });
    }
  }, []);

  return <div>Thank you for your purchase!</div>;
}

AJAX Form Submissions

Track conversions without page reload:

// After successful form submission
function onFormSuccess(response) {
  // Your success handling
  showSuccessMessage();

  // Track LinkedIn conversion
  window.lintrk('track', {
    conversion_id: 1234567,
    value: response.leadValue || 50,
    currency: 'USD'
  });
}

// Example with fetch
fetch('/api/submit-form', {
  method: 'POST',
  body: formData
})
.then(response => response.json())
.then(data => {
  if (data.success) {
    onFormSuccess(data);
  }
});

Event-Based Tracking

Track conversions on specific user interactions:

// Download button click
document.getElementById('downloadBtn').addEventListener('click', function() {
  window.lintrk('track', { conversion_id: 5555555 });
});

// Video completion
videoPlayer.on('ended', function() {
  window.lintrk('track', { conversion_id: 6666666 });
});

// Scroll depth
if (scrollPercent >= 75) {
  window.lintrk('track', { conversion_id: 7777777 });
}

Deduplication

Preventing Duplicate Conversions

Problem: Users refresh thank-you page, conversion fires multiple times

Solution 1: Session Storage

var conversionKey = 'linkedin_conversion_' + 1234567;

if (!sessionStorage.getItem(conversionKey)) {
  window.lintrk('track', { conversion_id: 1234567 });
  sessionStorage.setItem(conversionKey, 'true');
}

Solution 2: URL Parameter Check

// Only track if coming from form submission
if (window.location.search.includes('submitted=true')) {
  window.lintrk('track', { conversion_id: 1234567 });

  // Clean URL to prevent duplicate tracking on refresh
  if (history.replaceState) {
    history.replaceState({}, document.title, window.location.pathname);
  }
}

Solution 3: Cookie-Based

function getCookie(name) {
  var value = "; " + document.cookie;
  var parts = value.split("; " + name + "=");
  if (parts.length == 2) return parts.pop().split(";").shift();
}

function setCookie(name, value, days) {
  var expires = "";
  if (days) {
    var date = new Date();
    date.setTime(date.getTime() + (days*24*60*60*1000));
    expires = "; expires=" + date.toUTCString();
  }
  document.cookie = name + "=" + (value || "")  + expires + "; path=/";
}

if (!getCookie('linkedin_conv_1234567')) {
  window.lintrk('track', { conversion_id: 1234567 });
  setCookie('linkedin_conv_1234567', 'true', 30);
}

Testing and Verification

Browser Console Testing

// Check if lintrk function available
if (typeof window.lintrk === 'function') {
  console.log('✓ lintrk function available');

  // Manually trigger test conversion
  window.lintrk('track', { conversion_id: YOUR_CONVERSION_ID });
  console.log('✓ Test conversion fired');
} else {
  console.error('✗ lintrk function not found - check Insight Tag installation');
}

Network Tab Verification

  1. Open DevTools > Network tab
  2. Filter for "linkedin" or "px.ads.linkedin.com"
  3. Trigger conversion
  4. Look for request with conversion_id parameter
  5. Verify 200 status code

Expected request:

https://px.ads.linkedin.com/collect/?pid=1234567&conversionId=5678901&v=...

Campaign Manager Verification

Timeline:

  • Conversions appear within 24-48 hours
  • Real-time reporting not available
  • Test conversions may not appear (minimum spend required)

Check Conversion Health:

  1. Account Assets > Conversions
  2. View specific conversion
  3. Check recent activity
  4. Verify tracking status: Active/Inactive

GTM Debug Mode

When using GTM:

  1. Enable Preview mode
  2. Navigate to conversion page
  3. Check "Tags Fired" section
  4. Verify LinkedIn conversion tag appears
  5. Review tag data in debug panel

Best Practices

Implementation

  1. Place on Confirmation Pages Only - Don't track on form pages
  2. Use Static Conversion IDs - Never use variables for conversion_id
  3. Implement Deduplication - Prevent duplicate tracking
  4. Test Thoroughly - Verify before launching campaigns
  5. Document Conversions - Maintain list of conversion IDs and purposes

Value Tracking

  1. Dynamic for Transactions - Pass actual purchase amounts
  2. Static for Leads - Use average lead value
  3. Currency Consistency - Match Campaign Manager account currency
  4. Validate Values - Ensure proper number formatting
  5. Include Tax/Shipping - Use total order value

Conversion Design

  1. Meaningful Events - Track actions that matter to business
  2. Funnel Approach - Track micro and macro conversions
  3. Consistent Naming - Use clear, descriptive names
  4. Appropriate Attribution Windows - Match sales cycle length
  5. Right Counting Method - One vs. many per click based on goal

Privacy & Compliance

  1. Respect Consent - Only track with user permission
  2. No PII in Values - Don't pass personally identifiable information
  3. Secure Implementation - Use HTTPS pages
  4. Privacy Policy Disclosure - Inform users of tracking
  5. Honor Opt-Outs - Respect user preferences

Troubleshooting

Conversions Not Recording

Check:

  1. ✓ Insight Tag installed on conversion page?
  2. ✓ Conversion tracking code on confirmation page?
  3. ✓ Correct conversion ID?
  4. ✓ Window.lintrk function available?
  5. ✓ Network request firing?
  6. ✓ 24-48 hours passed since test?
  7. ✓ Minimum ad spend threshold met?

Common Issues:

  • Tag installed only on landing page, not confirmation page
  • Conversion code in wrong location (fires before Insight Tag loads)
  • JavaScript error preventing execution
  • AdBlockers preventing tracking (educate users)

Value Not Passing

Verify:

// Log value being passed
var orderTotal = 99.99;
console.log('Conversion value:', orderTotal);

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

Common Issues:

  • Value is string, should be number: value: parseFloat(orderTotal)
  • Currency mismatch with account settings
  • Value includes currency symbol: Use 99.99 not "$99.99"

GTM Tag Not Firing

Debug:

  1. Preview mode shows tag not triggered
  2. Check trigger configuration
  3. Verify data layer variables populated
  4. Review trigger conditions
  5. Check tag firing order

Conversion Types Reference

Lead Generation

Use Cases:

  • Form submissions
  • Demo requests
  • Contact inquiries
  • Quote requests

Implementation:

window.lintrk('track', {
  conversion_id: LEAD_CONVERSION_ID,
  value: 50, // Average lead value
  currency: 'USD'
});

E-commerce

Use Cases:

  • Product purchases
  • Checkout completions
  • Add to cart (micro-conversion)

Implementation:

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

Sign Ups

Use Cases:

  • Account registration
  • Newsletter subscription
  • Free trial starts

Implementation:

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

Downloads

Use Cases:

  • White paper downloads
  • App installations
  • Resource downloads

Implementation:

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

Next Steps

After implementing conversion tracking:

  1. Monitor Performance - Check conversion data in Campaign Manager
  2. Set Up Goals - Configure campaign optimization goals
  3. Analyze Attribution - Review click vs. view-through conversions
  4. Optimize Campaigns - Use conversion data for bidding and targeting
  5. Expand Tracking - Add micro-conversions for better insights

Additional Resources