Skip to main content
Add a trackingId to an element in your widget’s code, and Chatbase counts how often visitors see it and use it. No code on your website is needed. The counts and the click-through rate appear in Analytics → Widgets.
The trackingId is also the element’s label in analytics, so give each one a short name a person can read.

Add a trackingId

In the code editor, add trackingId to any element you want to track. It appears in autocomplete, and hovering it shows the rules.
The code editor showing trackingId on each element of a dealer finder widget, with its hover help open
With the AI Widget Builder, ask for it in your own words, for example “track clicks on the main buttons”. The builder only adds trackingIds when you ask.

Rules

  • The value is plain text written in the code: trackingId="Find a dealer". Variables, expressions and template literals such as trackingId={`Find ${city}`} are not allowed.
  • The value can’t be empty and is at most 100 characters.
  • Elements that share a trackingId count as one element. Use this for items rendered from a list, for example trackingId="Product card" on every card.
  • Renaming a trackingId starts a new row in analytics. The old name keeps its history.
When a rule is broken, the editor shows the error and blocks saving until you fix it.
The code editor showing the error trackingId must be plain text after a template literal was used as a trackingId

Supported elements

Layout components, text components and Map don’t accept a trackingId. Focusing or hovering an element is never counted.

What Gets Counted

Each time your agent shows a widget in a conversation is one appearance. For every tracked element in that appearance, Chatbase counts:
  • Impressions: 1 if the element was on screen. An element inside a state that never became active, a step the visitor never reached, or an empty list gets no impression.
  • Interactions: 1 if the visitor used the element at least once. Clicking a button five times in the same appearance still counts once.
The rate is interactions divided by impressions. Days are split by when the widget appeared, so each day’s rate stays between 0% and 100%. Widgets count in conversations from the chat widget, iframe embeds, Center Stage, Search and the Help page. Conversations from the API, MCP, the mobile SDKs, the Playground and the action and Q&A previews are not counted. When a visitor sees or uses a tracked element, their browser reports it to Chatbase. The report holds the element’s trackingId and links it to the conversation. It sends nothing the visitor typed or chose. If your consent tool still loads the chat when a visitor declines analytics, turn the reports off for that visitor with the disableWidgetTracking runtime option:
While the option is on, the chat sends no reports at all. Elements shown in that time get no impressions, so visitors who opt out don’t lower your rates. Elements still on screen when the option is cleared are counted from then on.