On this page
What this issue is
A visitor clicks an ad, lands on a page with utm_source, utm_campaign or a gclid (Google click ID) in the URL, and later opens your live chat. The chat tool creates a contact or lead, but it only knows what you gave it. If nobody passed the campaign data to the widget, the conversation has no source.
Why it costs you leads or sales
Chat leads are often high intent. If they show as direct or unknown, you cannot tell which campaigns produce them. Reports undervalue the channels that really drive chats, and you may cut budget from ads that work.
- Ad clickURL has utm_source and gclid
- Landing pageParameters visible in the URL
- Chat openedWidget gets no campaign data
- Chat lead in CRMSource: direct or unknown
- Ad reportingChat conversion not credited
The UTMs exist on landing but never reach the chat lead.
Example: 50 chat leads in a month. Before the fix most show no source; after, they are tied to campaigns.
How to check if your site has it
Open a private window
Visit your site with a test URL such as
https://yoursite.com/?utm_source=test&utm_medium=cpc&utm_campaign=chat-check.Browse to another page
Click at least one internal link so the URL loses its parameters, like a real visitor would.
Start a chat and give an email
Use a test email so you can find the lead afterwards.
Open the lead in your chat tool and CRM
Look for the source, campaign and click ID fields. If they are empty or say direct, the data is not being passed.
How to fix it
The pattern is the same everywhere: capture the parameters on landing, keep them for the session, then hand them to the chat widget. The exact method depends on your chat tool, so check its documentation for the term it uses (custom attributes, visitor properties, contact fields or hidden fields).
Capture parameters on landing
Read
utm_source,utm_medium,utm_campaign,utm_term,utm_contentandgclidfrom the URL and save them in first-party storage.Create matching fields
In your chat tool and CRM, create custom fields for each value so there is somewhere to store them.
Send them to the widget
When the widget loads, set the stored values as visitor or contact attributes using your chat vendor's API.
Map fields into the CRM
Make sure the chat integration copies these fields onto the lead or contact record.
(function () {
var keys = ['utm_source','utm_medium','utm_campaign','utm_term','utm_content','gclid'];
var params = new URLSearchParams(window.location.search);
var found = {};
keys.forEach(function (k) {
if (params.get(k)) found[k] = params.get(k);
});
if (Object.keys(found).length) {
sessionStorage.setItem('campaign', JSON.stringify(found));
}
})();
// Later, when your chat widget is ready, read it back:
function getCampaign() {
try { return JSON.parse(sessionStorage.getItem('campaign')) || {}; }
catch (e) { return {}; }
}
// Pass getCampaign() to your chat tool's attribute/identify call.Add a Custom HTML tag
Paste the capture script, trigger it on All Pages, and set it to fire before the chat tag using tag sequencing.
Add a second tag for the chat call
Call your chat vendor's attribute method with the stored values once the widget has loaded.
Add the script site-wide
Use a header and footer scripts plugin or your child theme's functions file to load it on every page.
Pass values to the widget
Add the vendor's attribute call after the chat plugin loads. Check whether the plugin has its own custom data setting.
Add the script to the theme
In Online Store > Themes > Edit code, add it to
theme.liquidbefore the closing head tag, or use Customer events if you prefer.Pass values to the chat app
Check whether your chat app lists custom attributes or order and visitor properties.
Add to custom code
In Project settings > Custom code, paste the script in the Head code area, then publish.
Add a custom code snippet
In Settings > Custom code, add the script to all pages, loading in the head.
Use Code Injection
In Settings > Advanced > Code Injection, paste the script into the Header field.
Use tracking code and hidden fields
Add the script in the funnel or website custom code settings, then map the stored values into contact custom fields.
Include the script in your base template
Load it on every page, then call your chat SDK's identify or attributes method with the stored values.
How to confirm it's fixed
- A test chat started after landing on a UTM URL shows the source, medium and campaign on the chat contact.
- The same values appear on the lead or contact in your CRM.
- The values survive navigating to a second page before chatting.
- The
gclidis stored on the lead when the landing URL included one. - Chats started with no UTMs still work and show a sensible default such as direct.
How to prevent it happening again
Chat widgets get replaced, upgraded or moved into new tag containers, and attribute calls often get lost. Repeat the manual test after any change to the chat tool, consent banner, theme or tag setup.
| Change | What can go wrong |
|---|---|
| New chat vendor or widget | Old attribute call no longer exists |
| Consent banner update | Capture script blocked or runs too late |
| Theme or template change | Script removed from the head |
| CRM field rename | Mapped fields stop filling |
How FunnelGuard handles this
FunnelGuard does not check this yet. Checking whether chat leads carry their campaign source is a possible future check, not a current feature.
What FunnelGuard does today is run your real customer journeys on a schedule, check each step and the tracking hits sent to ad and analytics platforms such as GA4, Google Ads and Meta, and confirm that test leads reach the inbox and CRM. That can show you if the page or tags around your chat are broken, but not whether a chat lead has its UTMs.
Questions people ask
Why are my live chat leads showing as direct?
The chat tool usually only knows the current page, and by the time someone chats the UTMs have often left the URL. Unless you stored the parameters and passed them to the widget, the lead is recorded with no source and reports call it direct or unknown.
How do I pass UTM parameters to a live chat widget?
Save the UTMs and click ID in first-party storage when the visitor lands, then set them as custom attributes using your chat vendor's API when the widget loads. Create matching fields in the chat tool and CRM so the values are stored on the lead.
Can I track live chat conversions in Google Ads?
Yes, if you store the gclid on the chat lead and later import the conversion, for example as an offline conversion. Without the click ID saved on the lead, there is nothing to match back to the ad click.
Why do UTMs disappear before the visitor opens chat?
UTMs live only in the landing URL. When the visitor clicks to another page, the new URL usually has no parameters, so anything reading the URL at chat time sees none. Storing them on landing solves this.
Do I need cookie consent to store UTMs for chat attribution?
That depends on your setup and local law, so follow your consent platform's rules and your legal advice. Test with consent accepted and declined so you know exactly what is stored in each case.
Does FunnelGuard check live chat attribution?
No, not yet. It is a possible future check. FunnelGuard currently checks journey steps, tracking hits and whether test leads reach the inbox and CRM, so you should test chat attribution manually.
How do I test that chat attribution works?
Open a private window on a URL with test UTMs, click to another page, start a chat with a test email, then check the chat contact and CRM record for source, campaign and click ID values.
Related issues
- TRK-257WhatsApp prefilled message missing the campaign/source tagFix guide
- TRK-256WhatsApp click not tracked as eventFix guide
- TRK-255Call conversions not sent back to Google AdsFix guide
- TRK-254CallRail/CallTrackingMetrics script blocked by consentFix guide
- TRK-249Dynamic number insertion (DNI) script not swapping numberFix guide
- TRK-250DNI swap fails on mobile tel: linksFix guide