Skip to main content
The SiteGPT widget sends JavaScript events to your page when a visitor uses the chat. Use them to measure chat activity and conversions in Google Tag Manager, Google Analytics 4 (GA4), or any other analytics tool. You do not change any setting in SiteGPT. The events work with every install that uses the widget script, including the WordPress plugin. They do not work with the iframe embed or the hosted chat link, because those do not run the widget script on your page. See Add SiteGPT to your website.
Your analytics code never goes inside the SiteGPT widget. The widget script runs on your own page, next to your GTM or GA4 code. The widget script sends each event to your dataLayer, to a window event, and to any $sitegpt callback.

Events

threadId is the ID of the conversation.
Payloads contain no personal data: no name, email, phone number, or message text. This makes them safe to send to GA4, which does not allow personal data. Lead details stay in your SiteGPT dashboard.

Delivery channels

SiteGPT sends every event in three ways at the same time:

Examples

Each event is pushed to window.dataLayer with the event name sitegpt_<event>. The payload fields are on the same object:
To use an event in GTM:
  1. Add a Custom Event trigger. Set Event name to the event, for example sitegpt_lead_submitted. To catch all SiteGPT events in one trigger, use sitegpt_.* and turn on Use regex matching.
  2. Optional: add Data Layer Variables named chatbotId, threadId, or url.
  3. Attach a tag, for example a GA4 Event tag, to the trigger.
The widget creates window.dataLayer if it does not exist. The events work even if GTM loads after the widget.

More than one chatbot on a page

Every payload includes the chatbotId of the chatbot that sent it. In GTM or GA4, filter on the chatbotId variable. In a callback, check data.chatbotId.

Widget SDK

Control the widget from your page.

Webhooks

Receive messages, leads, and escalations on your server.