How to track UTM sources with the Crisp chatbox
Learn how to capture UTM parameters and save them on the current Crisp session.
UTM parameters help you understand which campaign, channel, or source brought a visitor to your website. With a small JavaScript snippet, you can attach those values to the Crisp customer profile so your team sees campaign context directly in the conversation.
How UTM tracking works
UTM parameters are URL parameters commonly used by marketing teams to measure campaign performance across traffic sources. A visitor URL may look like this:
https://www.example.com/page?utm_content=buffercf3b2&utm_medium=social&utm_source=facebook.com&utm_campaign=bufferIn this example, utm_source tells you the visitor came from facebook.com. Saving this information in Crisp helps support, sales, and marketing teams understand where the conversation came from.
Add the UTM tracking script
Add this script on the pages where your visitors may land with UTM parameters, ideally after the Crisp chatbox snippet has been declared or anywhere window.$crisp is available.
<script>
window.$crisp = window.$crisp || [];
const searchParams = new URLSearchParams(window.location.search);
const utmKeys = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"];
const crispData = [];
utmKeys.forEach(function(key) {
const value = searchParams.get(key);
if (value) {
crispData.push([key, value]);
}
});
if (crispData.length > 0) {
$crisp.push(["set", "session:data", [crispData]]);
}
</script>
The script reads the current page URL, extracts the UTM values that are present, then sends them to Crisp using the session:data method.
Check the result in Crisp
After a visitor lands on a URL containing UTM parameters, open the conversation in Crisp and review the customer profile or session data area. You should see the UTM keys that were detected on the page.
A good test URL should include at least one UTM key:
- utm_source → identifies the source, such as
facebook.com,google, ornewsletter - utm_medium → identifies the channel, such as
social,email, orcpc - utm_campaign → identifies the campaign name
- utm_term → identifies a paid-search term when relevant
- utm_content → identifies a specific ad, link, or creative variation
Where to go next
You can adapt this pattern to save other attribution values on the Crisp session, such as landing page, referrer, or campaign identifiers generated by your own tools.
$crisp method reference in the Crisp Developer Hub.Updated on: 03/05/2026
Thank you!