Click tracking in widgets

Name the buttons, links and quick replies in a widget with trackAs to see which ones customers use, and read the counts in Analytics.

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

Click tracking tells you which parts of a widget customers actually use. Give a button, link or quick reply a tracking name and every tap is counted. Use it to compare two button labels, to see whether customers open the return policy link or to find parts of a widget nobody touches.

Add a tracking name

Add trackAs to an interactive component. The name is a short identifier in lowercase with underscores.

{
  "type": "button",
  "label": "Start a return",
  "onClick": "startReturn",
  "trackAs": "order_card_start_return"
}

Links and quick replies work the same way:

{
  "type": "link",
  "label": "Return policy",
  "url": "https://www.example.com/returns",
  "trackAs": "order_card_policy_link"
}

Tracking does not change what the component does. A tap still runs its function or opens its link.

Set appendUtm on a link to add UTM parameters to the address, so your own analytics can tell that the visit came from the chat.

{
  "type": "link",
  "label": "See the sizing guide",
  "url": "https://www.example.com/sizing",
  "appendUtm": true,
  "trackAs": "sizing_link"
}

The link then carries utm_source=askocto and utm_medium=widget. Tapping it is still counted under its trackAs name.

Read the results

  1. Open your agent and go to Analytics.
  2. Select the Widgets view.
  3. Choose a widget and a date range.

You should see each tracking name with its number of taps and the number of conversations it appeared in. Selecting a name lists the conversations, so you can read what the customer was asking at that moment. Taps also show up in the conversation's entry in Activity.

Naming tips

  • Start every name with the widget, for example order_card_, so names group together in the list.
  • Name the action, not the position: start_return ages better than second_button.
  • Keep names stable. Renaming a component starts a new count.
  • Never put personal data, order numbers or email addresses in a name.

Note: Click tracking counts taps on components. It does not read what the customer typed in an input. Use states and functions for that.

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