Track Microsoft, LinkedIn & TikTok Click IDs in WordPress

You’re running ads on Microsoft, LinkedIn, and TikTok alongside your Google and Meta campaigns. Leads are coming in, but when you check your CRM, half of them say “direct traffic” or have no source at all. Your Microsoft Ads dashboard shows 30 conversions last month. Your LinkedIn campaign report claims 15 leads. But your form submissions tell you nothing about which platform sent which lead.

The problem is the same one that affects gclid and fbclid tracking — click IDs vanish the moment a visitor navigates away from your landing page. But while Google and Meta get all the attention, the click IDs from Microsoft Ads (msclkid), LinkedIn Ads (li_fat_id), and TikTok Ads (ttclid) are almost never covered in WordPress guides.

This guide fixes that. You’ll learn what each click ID does, how to capture it in your WordPress forms, and how to handle the browser privacy limits that silently break tracking on Safari, Brave, and Firefox.

Every Ad Platform Click ID at a Glance

Each advertising platform appends its own click identifier to your landing page URL when someone clicks an ad. Here’s how they compare:

ParameterPlatformCookie DurationSafari ITP LimitAuto-Tagged
gclidGoogle Ads90 days24 hours / 7 daysYes
fbclidMeta (Facebook/Instagram)90 days24 hours / 7 daysYes
msclkidMicrosoft Ads (Bing)90 days24 hours / 7 daysYes (opt-in)
li_fat_idLinkedIn Ads30 days24 hours / 7 daysYes (opt-in)
ttclidTikTok Ads30 days24 hours / 7 daysYes

Safari ITP note: When Safari classifies the referring domain as a cross-site tracker, JavaScript-set cookies on the landing page expire after 24 hours. On subsequent pages (without the click ID in the URL), the general 7-day cap applies. See the browser privacy section below for full details.

We’ve already covered gclid (Google Ads) and fbclid (Meta Ads) in dedicated guides. This article focuses on the three remaining click IDs: msclkid, li_fat_id, and ttclid.

Microsoft Ads — Tracking msclkid in WordPress

What Is msclkid

The Microsoft Click ID (msclkid) is a unique hex string identifier that Microsoft Ads appends to your landing page URL when auto-tagging is enabled. It looks something like this:

https://yoursite.com/landing-page/?msclkid=abc123def456abc123def456abc123de

Microsoft’s Universal Event Tracking (UET) tag reads the msclkid from the URL and stores it in a first-party cookie called _uetmsclkid, which expires after 90 days. This cookie powers Microsoft’s conversion tracking — when a UET event fires, the msclkid links that conversion back to the specific ad click.

But here’s the catch: if you want the msclkid in your form submissions (not just in Microsoft’s conversion reports), you need to capture it separately. The UET tag doesn’t pass the click ID to your form plugin.

Enable Auto-Tagging in Microsoft Ads

Auto-tagging is off by default. To enable it:

  1. Sign in to your Microsoft Ads account
  2. Go to All campaigns → Settings → Account level options
  3. Check “Add Microsoft Click ID (MSCLKID) to URLs to allow conversion tracking”
  4. Click Save

Once enabled, every ad click automatically appends ?msclkid=... to your destination URL.

Capturing msclkid in WordPress Forms

The capture pattern is the same one used for gclid tracking:

  1. JavaScript reads msclkid from the URL on the landing page
  2. The value is stored in a first-party cookie so it persists across pages
  3. When the visitor submits a form, the cookie value is written into a hidden field and included with the submission

The manual JavaScript method is covered in the unified code snippet section below. If you’d rather skip the code, LeadSourcePro captures msclkid automatically across nine form plugins — no hidden fields required.

LinkedIn Ads — Tracking li_fat_id in WordPress

What Is li_fat_id

LinkedIn’s first-party ads tracking identifier (li_fat_id, formally LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID) is appended to your landing page URL when someone clicks a LinkedIn ad. A URL with li_fat_id looks like:

https://yoursite.com/demo/?li_fat_id=a1b2c3d4-e5f6-7890-abcd-ef1234567890

Unlike gclid and fbclid, which generate a new value with every click, li_fat_id stays the same for a given user across multiple clicks. This makes it especially useful for B2B attribution where the same person may click multiple LinkedIn ads over weeks before converting.

The li_fat_id cookie expires after 30 days from the last click. However, Safari’s Intelligent Tracking Prevention (ITP) limits this dramatically — more on that in the browser privacy section.

Enable Enhanced Conversion Tracking

li_fat_id is only appended to your ad URLs when enhanced conversion tracking is enabled:

  1. Open LinkedIn Campaign Manager
  2. Go to Analyze → Insight Tag
  3. Click Manage Insight Tag
  4. Check “Enable enhanced conversion tracking”

This is enabled by default for all new Insight Tags created after 2023. If your Insight Tag is older, you may need to enable it manually.

Why li_fat_id Matters for B2B

The B2B attribution gap: A prospect clicks your LinkedIn ad in January, browses your site, but doesn’t convert. They return in March via a direct visit and submit your contact form. Without the li_fat_id stored from that original click, LinkedIn has no way to attribute the conversion back to your campaign. Your CRM shows a lead with no source. LinkedIn shows zero conversions. Your ad spend looks wasted — even though it worked.

When you send the li_fat_id back to LinkedIn via their Conversions API, it dramatically improves match rates. Industry reports suggest match rates can drop to 40–60% when relying on email-only matching without the click ID. Capturing and persisting li_fat_id closes that gap.

Capturing li_fat_id in WordPress Forms

The JavaScript capture follows the same pattern as msclkid: read from URL, store in cookie, populate hidden field on form submission. The unified code snippet below covers all three click IDs. LeadSourcePro captures li_fat_id automatically with no configuration.

TikTok Ads — Tracking ttclid in WordPress

What Is ttclid

The TikTok Click ID (ttclid) is a tracking parameter appended to your landing page URL when someone clicks a TikTok ad. Since April 2024, TikTok auto-appends ttclid to all ad destination URLs — no manual URL template needed.

https://yoursite.com/offer/?ttclid=abc123.xyz789.AbCdEfGhIjKlMnOpQrStUvWxYz

The ttclid value itself is valid for 30 days. TikTok’s default click-through attribution window in Ads Manager is 7 days, but this is configurable up to 28 days — don’t confuse the attribution window setting with the click ID’s actual validity.

TikTok Events API and WordPress

When you send events to TikTok via the Events API (server-to-server), including the ttclid improves attribution accuracy. TikTok matches the click ID to the original ad interaction and uses it for audience building, ad delivery optimisation, and measurement.

TikTok supports both standard events (SubmitForm, Contact, Lead, CompleteRegistration, and others) and custom events. Custom events can be used for reporting and audience creation, though not for campaign optimisation — only standard events drive TikTok’s bidding algorithms.

WordPress Caching and ttclid

TikTok traffic is overwhelmingly mobile. If your WordPress site uses aggressive page caching, the server may serve a stale cached page that doesn’t process the ttclid query parameter. This affects server-side tracking only — client-side JavaScript can still read the ttclid from the browser’s URL bar regardless of caching.

If you use a JavaScript-based capture method (either manual or via a plugin like LeadSourcePro), caching won’t interfere with ttclid capture. The same applies to msclkid and li_fat_id — caching is a common reason tracking data disappears, but client-side capture sidesteps the issue entirely.

Capturing ttclid in WordPress Forms

Same pattern: read from URL, store in cookie, populate hidden field. See the unified code snippet below, or install LeadSourcePro for automatic capture.

Capture msclkid, li_fat_id & ttclid with One JavaScript Snippet

If you want to capture all three click IDs manually, here’s a JavaScript snippet that handles the full workflow: reading the parameters from the URL, storing them in cookies, and populating hidden form fields.

The JavaScript Snippet

Add this script to your site’s <head> section via a code snippets plugin (like WPCode) or your child theme’s functions.php using wp_enqueue_script:

// Capture ad platform click IDs on page load
(function() {
  var params = new URLSearchParams(window.location.search);
  var clickIds = ['msclkid', 'li_fat_id', 'ttclid'];
  var cookieDays = 7; // Adjust as needed (max 7 for Safari)

  clickIds.forEach(function(id) {
    var value = params.get(id);
    if (value) {
      var expires = new Date();
      expires.setDate(expires.getDate() + cookieDays);
      document.cookie = id + '=' + encodeURIComponent(value)
        + ';expires=' + expires.toUTCString()
        + ';path=/;SameSite=Lax';
    }
  });
})();

This captures whichever click ID is present in the URL and stores it in a first-party cookie. The cookie persists across page navigations so the value is available when the visitor reaches your form — even if it’s on a different page.

Adding Hidden Fields to Your Forms

Next, add hidden fields to your form plugin and populate them from the cookies. The exact steps vary by plugin — our hidden form fields guide covers the process for Contact Form 7, WPForms, Gravity Forms, and others.

Then add a second script that reads the cookies and writes the values into the hidden fields when the form page loads:

// Populate hidden form fields from cookies
document.addEventListener('DOMContentLoaded', function() {
  var clickIds = ['msclkid', 'li_fat_id', 'ttclid'];

  clickIds.forEach(function(id) {
    var match = document.cookie.match(
      new RegExp('(?:^|; )' + id + '=([^;]*)')
    );
    if (match) {
      var fields = document.querySelectorAll(
        'input[name="' + id + '"]'
      );
      fields.forEach(function(field) {
        field.value = decodeURIComponent(match[1]);
      });
    }
  });
});

Limitations of the Manual Approach

This method works, but it has real maintenance costs:

  • Hidden fields in every form. You need to add msclkid, li_fat_id, and ttclid hidden fields to every form on your site — and update them if you add new forms or switch plugins.
  • Plugin-specific syntax. Contact Form 7 uses [hidden msclkid]. WPForms uses a Hidden Field element. Gravity Forms uses Dynamic Population. Each requires different configuration.
  • No automatic source detection. The script captures click IDs but doesn’t label the traffic source. You’ll need to map msclkid → Microsoft Ads, li_fat_id → LinkedIn Ads, etc. in your CRM or spreadsheet.
  • Fragile across updates. Theme updates, plugin updates, or a redesign can break the script or remove hidden fields without warning.

If maintaining custom JavaScript across every form sounds unsustainable — especially if you’re already tracking gclid and fbclid too — the automated approach below eliminates these issues entirely.

How to Verify Click IDs Are Being Captured

After implementing the code, test it:

  1. Simulate an ad click. Visit your landing page with the click ID in the URL — e.g., yoursite.com/page/?msclkid=test123
  2. Check the cookie. Open your browser’s DevTools (F12), go to the Application tab → Cookies, and look for a cookie named msclkid with the value test123
  3. Navigate to your form page. The cookie should persist. Check it again in DevTools.
  4. Submit a test form. Check the form entry in your form plugin’s submission log — the hidden field should contain the click ID value.

Repeat with li_fat_id and ttclid to confirm all three are working.

Browser Privacy Limits — How Safari, Brave, and Firefox Affect Click IDs

Browser privacy features are the single biggest threat to click ID tracking. Each browser handles click IDs differently, and the restrictions are getting stricter every year.

Safari (Intelligent Tracking Prevention)

Safari’s ITP applies two layers of cookie restrictions that affect all click IDs:

  • 24-hour cap on the landing page. When Safari classifies the referring domain (google.com, facebook.com, linkedin.com, bing.com, tiktok.com) as a known cross-site tracker, any JavaScript-set cookie on the landing page expires after 24 hours.
  • 7-day cap on subsequent pages. On pages where the click ID isn’t in the URL, JavaScript-set cookies are capped at 7 days.

This means the cookie your JavaScript sets from the msclkid, li_fat_id, or ttclid parameter will expire within 24 hours on Safari for most visitors — before many B2B leads ever reach your form. Server-side cookie setting (using PHP or a server-side plugin) bypasses ITP because Safari treats server-set cookies differently from JavaScript-set cookies.

Chrome

Chrome enforces a 400-day maximum cookie lifetime (shipped in Chrome 104, August 2022). For click ID tracking, this is generous — a 7-day or 30-day cookie will work normally. Chrome is also deprecating third-party cookies, which affects ad platform pixels (like the UET tag and LinkedIn Insight Tag) but does not affect first-party cookies set by your own JavaScript.

Brave

Brave strips click IDs (gclid, fbclid, msclkid, and others) from URLs by default. The parameters never reach your page, so there’s nothing to capture. Brave preserves UTM parameters during normal navigation, so UTM-based attribution still works. Brave also blocks many ad platform tracking scripts (UET tag, Insight Tag, TikTok Pixel) entirely.

Firefox (Enhanced Tracking Protection)

Firefox’s Enhanced Tracking Protection (ETP) blocks third-party tracking cookies by default and restricts scripts from known trackers. While Firefox doesn’t strip click IDs from URLs (like Brave does), it may block the ad platform pixels that read them. First-party cookies set by your own JavaScript are not affected by ETP.

Bottom line: Safari is your biggest concern. If you have significant Safari/iOS traffic (check your analytics), JavaScript-set click ID cookies will expire within 24 hours for most ad-click visitors. For longer conversion cycles, especially in B2B, server-side cookie persistence or a plugin that sets cookies via PHP is the most reliable approach.

The Automated Approach with LeadSourcePro

LeadSourcePro captures msclkid, li_fat_id, and ttclid automatically — alongside gclid, fbclid, and all UTM parameters. There are no hidden fields to add, no JavaScript snippets to maintain, and no per-form configuration.

Here’s how it works:

  1. Capture. A lightweight vanilla JavaScript file runs on every page load and reads any click IDs or UTM parameters from the URL.
  2. Persist. The data is stored in a first-party cookie with a configurable conversion window (same session, 1 day, or 7 days).
  3. Attach. When the visitor submits a form, LeadSourcePro hooks directly into your form plugin and attaches the traffic source data. No hidden fields needed for the nine natively supported plugins (Contact Form 7, WPForms, Gravity Forms, Ninja Forms, Formidable Forms, Fluent Forms, Elementor Pro Forms, Forminator, and Jetpack Forms). A [utm_tracker_fields] shortcode provides a fallback for other forms.
  4. Report. Every submission appears in your WordPress dashboard with the full attribution trail — traffic source, UTM parameters, click IDs, landing page, and referrer.

The plugin also auto-detects the traffic source. If a visitor arrives with an msclkid, LeadSourcePro labels it “Microsoft Ads.” If they have a li_fat_id, it’s “LinkedIn Ads.” No manual mapping required.

Track Every Click ID Across Every Ad Platform

LeadSourcePro captures gclid, fbclid, msclkid, li_fat_id, and ttclid automatically — plus all UTM parameters. Install the free plugin and start seeing which ads drive your form submissions in under two minutes.

Frequently Asked Questions

Do I need all three click IDs if I only advertise on one platform?

No. Capture only the click IDs for the platforms you actively use. If you only run Microsoft Ads, you only need msclkid. But if you run campaigns across multiple platforms (or plan to in the future), capturing all click IDs from the start means you won’t lose attribution data when you expand to new channels.

Can I track click IDs alongside UTM parameters?

Yes, and you should. Click IDs and UTM parameters serve different purposes. Click IDs power each platform’s conversion tracking and optimisation (feeding data back to Microsoft, LinkedIn, or TikTok). UTM parameters power your analytics reporting in tools like Google Analytics. Using both gives you complete attribution from both angles.

Do I still need the UET tag, Insight Tag, or TikTok Pixel if I capture click IDs in my forms?

Yes. The platform pixels serve a different purpose — they report conversion events directly to the ad platform for campaign optimisation and audience building. Capturing click IDs in your forms gives you the data in your CRM or WordPress dashboard. The two approaches complement each other. The pixel optimises your ads; the form data tells you which specific lead came from which ad.

What happens if a visitor arrives with both a click ID and UTM parameters?

Both are captured independently. A Microsoft Ads click might produce a URL like ?utm_source=bing&utm_medium=cpc&msclkid=abc123. Your tracking should capture all of them — the UTMs for your analytics, and the msclkid for Microsoft’s conversion tracking. LeadSourcePro captures both automatically.

Does capturing click IDs affect page speed?

No. The JavaScript that reads URL parameters and sets a cookie runs in microseconds — far less than a single image load. There are no external API calls, no additional HTTP requests, and no impact on your Core Web Vitals. LeadSourcePro’s frontend script is vanilla JavaScript with no jQuery dependency.

Stop Flying Blind on Multi-Platform Campaigns

Every form submission without a traffic source is a data gap. When you’re running ads across Microsoft, LinkedIn, and TikTok — on top of Google and Meta — those gaps multiply fast. You end up making budget decisions based on which platform’s dashboard tells the most flattering story, not which one actually generates leads.

The fix is the same for every click ID: capture it on arrival, persist it in a cookie, and attach it to the form submission. You can build it yourself with the JavaScript snippets in this guide, or install LeadSourcePro and have all five click IDs tracked automatically across every form on your site.

See how LeadSourcePro works or install the free version and start tracking in under two minutes.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *