Appearance
Widget Tracking Analytics (GTM / GA4 / Meta)
Use this guide to connect Chat Widget Tracking events to your analytics stack.
Scope
Chat Widget Tracking applies only to conversations from the embedded web chat widget.
It does not apply to SMS, email, voice, or websocket-only dashboard flows.
Browser event contract
For each tracking outcome, the widget dispatches two CustomEvents on window:
- Stable event name:
autochat.widget_tracking.v1 - Canonical alias event name:
<event_type>(for exampleautochat.lead_qualified.v1)
event.detail shape:
ts
{
scope: 'chat_widget_tracking';
event_id: string;
event_type: string;
occurred_at: string;
conversation_id: string;
session_id?: string | null;
trigger_source: string;
data: Record<string, unknown>; // redacted payload only
dispatch_version: 1;
}Privacy model
Transported data is redacted-only in v1.
Tenant organizations remain responsible for their own legal/privacy policies and any downstream analytics processing.
Quick listener test
html
<script>
window.addEventListener('autochat.widget_tracking.v1', (event) => {
console.log('Widget tracking event', event.detail);
});
</script>If no logs appear, review troubleshooting at the bottom of this page and in Live Chat Troubleshooting.
GTM setup
1) Trigger
Create a Custom Event trigger with event name:
autochat.widget_tracking.v1
2) Variables (Data Layer Variable type)
Map from event detail:
event.detail.event_typeevent.detail.event_idevent.detail.trigger_sourceevent.detail.conversation_id
3) Tag routing options
- Single tag keyed by
event_typeparameter. - One tag per canonical alias event type.
GA4 mapping recipe
Recommended GA4 event name:
chat_widget_tracking
Recommended params:
autochat_event_type=event.detail.event_typeautochat_event_id=event.detail.event_idautochat_trigger_source=event.detail.trigger_sourceautochat_scope=event.detail.scope
Optional: include selected redacted values from event.detail.data.
Meta Pixel mapping recipe
Recommended options:
- Send a custom event:
fbq('trackCustom', 'AutochatWidgetTracking', { ... })
- Map selected canonical types to standard events when policy allows.
Example bridge:
html
<script>
window.addEventListener('autochat.widget_tracking.v1', (event) => {
const d = event.detail || {};
if (!window.fbq) return;
window.fbq('trackCustom', 'AutochatWidgetTracking', {
autochat_event_type: d.event_type,
autochat_event_id: d.event_id,
autochat_trigger_source: d.trigger_source,
});
});
</script>Tracking code templates in app
Open Settings → Chat Widget → Tracking (/settings/widget?tab=tracking) for copyable host-page templates:
- Guided Snippet Builder (provider/event selection + preview + copy)
- stable listener (
autochat.widget_tracking.v1) - canonical alias listener (
autochat.goal_met.v1example) - GA4
gtagbridge (event_idincluded) - Meta
fbqbridge (event_idincluded) - optional dataLayer push template
Rollout behavior:
- Guided Snippet Builder is available to all tenants. The Grain flag
widget_tracking_snippet_builder_enableddefaults to true (fail-open) and can be set to false to disable if needed. - Static templates remain available regardless of builder gate state.
- If snippet preset metadata is unavailable, UI uses built-in deterministic defaults and displays a fallback notice.
Canonical event types
autochat.contact_info_obtained.v1autochat.lead_qualified.v1autochat.escalation_triggered.v1autochat.followup_scheduled.v1autochat.followup_inferred.v1(allowlisted; may not be emitted yet)autochat.appointment_scheduled.v1autochat.goal_met.v1
Debug checklist
- Confirm widget endpoint responses include a
trackingblock. - Confirm browser receives
autochat.widget_tracking.v1events. - Confirm GTM trigger fires on
autochat.widget_tracking.v1. - Confirm mapped GA4/Meta tags fire in preview/debug tools.
- If duplicates appear, verify event IDs in your downstream tool.
- If missing events, confirm mapping
emit_browser=truein Widget Tracking settings.
Operational health
Use Settings → Chat Widget → Tracking → Widget Tracking Health to monitor:
- emission volume
- webhook attempts/failures
- per-event-type delivery quality
- recent redacted failures

