Track form submissions with Google Tag Manager
On this page
Tracking completed forms shows which pages, campaigns and posts bring leads. With Google Tag Manager you can send an event to Google Analytics each time a visitor finishes a conversational form. No code changes are needed.
Before you start you need a Google Tag Manager container on your site and a Google Analytics tag in it.
Step 1: Mark the end of the form
- Open WPBot Pro → ChatBot → Forms and click Edit on the form you want to track.
- Make sure the last field is an HTML field, for example the thank-you message.
- In its Content, wrap the message in an element with a class name you choose:
<div class="wpbot-quote-done">Thank you! We will call you soon.</div>
- Click Save Conversational Form.
The element only appears when the visitor reaches the end of the form, so its appearance means "form completed". Use a different class for each form you want to tell apart.
Step 2: Create the trigger
In Google Tag Manager:
- Open Triggers and click New. Name it, for example "Quote form completed".
- Choose the trigger type Element Visibility.
- Set Selection Method to CSS Selector and enter your class with a dot, for example
.wpbot-quote-done. - Set When to fire this trigger to Every time an element appears on screen.
- Tick Observe DOM changes. The chat adds messages after the page loads, so this is required.
- Save the trigger.
Step 3: Create the tag
- Open Tags and click New. Name it, for example "Quote form submit".
- Choose a Google Analytics event tag and name the event, for example
chatbot_form_submit. Add parameters such as the form name if you like. - Under Triggering, choose the trigger from step 2.
- Save the tag.
Step 4: Test and publish
- Click Preview in Google Tag Manager, open your site, start the form in the chat and finish it.
- Check that the tag fired, and that the event appears in Google Analytics under Realtime.
- Click Submit in Google Tag Manager to publish the container.
Mark the event as a key event (conversion) in Google Analytics to see which channels bring form leads.
Tip
Site Insight shows what visitors did before they converted. Together with this event in Google Analytics, you see which article, post or campaign led to each lead. See Getting started with Site Insight: learn what visitors do, then fix and grow.
The original step-by-step guide with screenshots is on our site: Tracking form submissions with Google Tag Manager.
Availability
In Master and Professional, with Conversational Forms. Not in Starter or WPBot Free.
Was this article helpful?
Sorry about that. Get help another way:

