UTM tracking in the website chat

Keep the UTM parameters of the page a visitor arrived on with each conversation, so you can see which campaigns bring people to the chat.

Working draft. These docs are illustrative: names, endpoints and examples describe the intended behaviour and can change before launch.

When a visitor arrives from a campaign link, the address usually carries UTM parameters. UTM tracking saves those values with the conversation, so you can see which campaigns lead to chats, leads and handoffs. It works with the chat bubble and does not need extra code.

Turn it on

  1. Open your agent and go to Channels > Website widget.
  2. Open the Tracking section.
  3. Switch on Capture UTM parameters.
  4. Select Save.

The embed script reads the parameters on the first page a visitor loads and keeps them for the browser session, even if the visitor moves to other pages before opening the chat.

What is captured

Parameter Example
utm_source newsletter
utm_medium email
utm_campaign spring_sale
utm_term rain_jacket
utm_content hero_button

For a link such as the one below, the conversation records all five values:

https://www.example.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=spring_sale

Only the parameters present in the address are saved. Missing ones are left out.

Where to see the values

  1. Open your agent and go to Activity.
  2. Select a conversation.
  3. Look in the details panel under Source.

You should see the UTM values next to the channel and the start time. The same values are included in the conversation metadata that webhook deliveries such as conversation.started carry, so your own systems can group conversations by campaign. See Webhooks.

Add your own campaign data

If your campaign ids do not use UTM names, pass them with setContext:

const params = new URLSearchParams(window.location.search)
window.askocto.setContext({ campaignId: params.get("cid") })

See Chat interface control for how context reaches the agent.

Note: UTM values describe how a visitor arrived, not who they are. Do not add personal data to campaign links, because addresses end up in browser history and server logs.

Troubleshooting

  • No UTM values appear. Check that the toggle is on and that the visitor landed on a page that loads the script with the parameters in the address.
  • Values are missing after a redirect. Some redirects drop the query string. Make sure the final address still carries the parameters.
  • Old conversations have no values. Capture starts when you turn it on. Earlier conversations are not updated.

Related: the website integration overview lists every embed option.

Something unclear or missing? Tell us and we will fix the page.