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
- Google Tag Manager
- GA4 (gtag.js)
- Custom JavaScript
Each event is pushed to To use an event in GTM:
window.dataLayer with the event name sitegpt_<event>. The payload fields are on the same object:- Add a Custom Event trigger. Set Event name to the event, for example
sitegpt_lead_submitted. To catch all SiteGPT events in one trigger, usesitegpt_.*and turn on Use regex matching. - Optional: add Data Layer Variables named
chatbotId,threadId, orurl. - Attach a tag, for example a GA4 Event tag, to the trigger.
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 thechatbotId of the chatbot that sent it. In GTM or GA4, filter on the chatbotId variable. In a callback, check data.chatbotId.
Related
Widget SDK
Control the widget from your page.
Webhooks
Receive messages, leads, and escalations on your server.