Analytics
Google Tag Manager
Learn how to set up Google Tag Manager (GTM) for your DocuChat chatbots.
Google Tag Manager (GTM) integration allows you to track user interactions with your DocuChat chatbots. This enables you to gather valuable analytics data and understand how users engage with your chatbot.
If you input a GTM code and enable tracking, you are responsible for ensuring data protection and privacy compliance, including notice and consent requirements.
Setup
- Create or open your Google Tag Manager account
- Locate your GTM Container ID (format: GTM-XXXXXX)
- Sign in to DocuChat as a SuperAdmin
- Navigate to Settings > Organization Settings
- Enter your GTM Container ID in the tracking settings section
Available Events
DocuChat automatically pushes the following events to the GTM data layer:
Event Name | Description |
---|---|
chat_initialized | Triggered when the chat interface loads |
question_asked | Triggered when a user submits a question |
answer_received | Triggered when the chatbot provides an answer |
chat_restarted | Triggered when the chat session is restarted |
cta_clicked | Triggered when a user clicks the call-to-action button |
chat_window_resized | Triggered when the chat widget is maximized/minimized (widget embeds only) |
Implementation Guide
- Create Triggers in GTM
- Go to your GTM workspace
- Create new triggers for each event you want to track
- Use "Custom Event" as trigger type
- Enter the exact event name (e.g.,
chat_initialized
)
- Set Up Tags
- Create tags for your analytics platform (e.g., Google Analytics 4)
- Associate the tags with the triggers you created
- Configure the tag parameters according to your analytics needs
- Testing
- Use GTM's Preview mode to verify that events are being captured
- Interact with your chatbot and confirm events appear in the preview panel
- Publish your GTM container once testing is successful