The Google Events setting enables you to fire events when a form, tab or field is interacted with.
Enable Google Events
To enable Google Events:
- Click the form settings icon at the top of the layout editor.
- Click the Tracking tab.
- Check the Enable checkbox under Google Events.
- Check one or more of the following options:
- Form
This will fire an event when a form is saved or submitted. - Tabs
This will fire an event when a tab is clicked on. One event is fired per tab click per form session. - Fields
This will fire an event when a field is interacted with. One event is fired per field per form session.
- Form
Note that WS Form PRO does not install the Google tags for you. You should do that with an additional plugin or embed it in your theme code.
Google Analytics Events
WS Form PRO automatically detects if you have Google Analytics installed and automatically fires events using the code appropriate to your tag version. The following versions of Google Analytics are supported:
- gtag.js (Universal and Google Analytics 4)
- analytics.js (Deprecated)
- ga.js (Deprecated)
The format of each event is shown below:
Event | Data Layer |
---|---|
Submit | event_category: Form - #form_label |
Save | event_category: Form - #form_label |
Tab | event_category: Form - #form_label |
Field | event_category: Form - #form_label |
Form Submit Events
WS Form also fires two other events to ensure compatibility with Google Analytics built-in form functionality:
Event | Data Layer |
---|---|
form_submit Enhanced Event Measurement |
form_id |
gtm.formSubmit | gtm.element |
Google Tag Manager
If you are using the latest Google Tag Manager embed code, it will not expose gtag to the data layer. You will need to add the following code to enable this:
<script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments)}; </script>
You can learn more about this technique here.
Custom Events
To fire custom events, see the Conversion Tracking action for more information.