Google Events

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:

  1. Click the form settings icon at the top of the layout editor.
  2. Click the Tracking tab.
  3. Check the Enable checkbox under Google Events.
  4. Check one or more of the following options:
    1. Form This will fire an event when a form is saved or submitted.
    2. Tabs This will fire an event when a tab is clicked on. One event is fired per tab click per form session.
    3. Fields This will fire an event when a field is interacted with. One event is fired per field per form session.

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 wsf_form_id: #form_id wsf_form_instance_id: #form_instance_id wsf_form_label: #form_label_id
Save event_category: Form - #form_label wsf_form_id: #form_id wsf_form_instance_id: #form_instance_id wsf_form_label: #form_label_id
Tab event_category: Form - #form_label event_label: #tab_label wsf_group_id: #group_id wsf_form_id: #form_id wsf_form_instance_id: #form_instance_id wsf_form_label: #form_label_id
Field event_category: Form - #form_label event_label: #field_label wsf_section_id: #section_id wsf_field_id: #field_id wsf_form_id: #form_id wsf_form_instance_id: #form_instance_id wsf_form_label: #form_label_id

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 form_name form_destination form_submit_text wsf_form_id: #form_id wsf_form_instance_id: #form_instance_id wsf_form_label: #form_label_id
gtm.formSubmit gtm.element gtm.elementId gtm.elementClasses gtm.elementUrl wsf_form_id: #form_id wsf_form_instance_id: #form_instance_id wsf_form_label: #form_label_id

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.