Google Tag Manager Event Tracking

ActionTag integrates with Google Tag Manager Event tracking so that you can more readily understand how users are interacting with your forms. This integration is available on all form types. The instructions below are for utilizing Universal Analytics in your Google Tag Manager implementation.

Google Analytics 4

Google launched Google Analytics 4 (GA4) in October 2020 and later announced that they will be deprecating Universal Analytics (aka GA3) on July 1, 2023. Google account settings and historical data will not be transferrable from GA3 to GA4, so if you want to maintain year-over-year data in GA4, you may want to begin using GA4 before July 1, 2022. You can do this now by adding the code for your GA4 property to your Online Actions form themes.

Please note that the “Google Account ID Number” field on the Basics step of your Online Actions form and page setup takes one of two types of identifiers. One, starting with UA, is meant for Universal Analytics, which is the predecessor to GA4. The other, starting with GTM, is for Google Tag Manager, which can work with GA4. We are currently evaluating the need for any additional GA4 integrations on the platform, and we will provide updated documentation on handling event tracking with GA4 when it is available.

Google Analytics Events

This is the data that will be passed to Google Analytics via Google Tag Manager upon successful integration. This data will be viewable in the Google Analytics Events reporting interface.

Event

Trigger

eventCategory

eventAction

eventLabel

eventValue

Form loaded

postRender callback

ActionTag form type, e.g. Contribution, Petition

Form Load

Form Template

Number of fields in the form

Form fill

postFill callback

ActionTag form type, e.g. Contribution, Petition

Form Fill

Form fill source, identical to the value of fill_source during alterFill, e.g. FastAction

Number of fields filled

Form submitted

preSegue callback

ActionTag form type, e.g. Contribution, Petition

Form Submit

Submit Button text, e.g. Contribute, Donate

For ActionTag forms of type Contribution or Event, the monetary amount paid

Form abandoned

window.onbeforeunload event

ActionTag form type, e.g. Contribution, Petition

Form Abandoned

Last field focused on (using the name assigned to the input element), e.g. SelectAmount, FirstName

Number of fields completed

Captcha called

form submission (except Smart Links)

ActionTag form type, e.g. Contribution, Petition

Captcha Called

Google Recaptcha v2 Invisible

(null)

Additional dataLayer Variables

In addition to eventCategory, eventAction, eventLabel, and eventValue, the following variables are sent to the Google Tag Manager dataLayer when each event fires.

Field

Value

sourceCodeId

The source code that will be applied to the person who submits this form - retrieved from the query string parameter if present, or from the form definition if not present in the query string

activistCodes

An array of activist code IDs that will be applied to the person who submits the form

tenantUri

A unique string relating to the committee that the form is associated with

formName

The form name selected during the creation process

formShortCode

A unique identifier that can be utilized to search for the form inside Online Actions

Example

The following object provides an example of data that would be passed into the Google Tag Manager DataLayer when a Contribution form is loaded.

{
    event: 'FormEvent',
    eventCategory: 'ContributionForm',
    eventAction: 'Form Load',
    eventLabel: 'Minimal',
    eventValue: 12,
    activistCodes: ['3456','8901'],
    sourceCodeId: 2345,
    tenantUri: 'ngpvan://van/EA/EA001/1/2',
    formShortCode: 'OQbID4vGGESISlTSrmpTsw2'
  }

Utilizing Form Events in your Google Tag Manager Setup

Before completing these steps, ensure that your Google Tag Manager container is installed properly and utilizing the default “dataLayer” on the page which displays the ActionTag form.

  1. In your Google Tag Manager container, create a new Trigger with the trigger type “Custom Event”.
  2. Set the Event name for your new trigger to “FormEvent” (this is case sensitive) and allow the trigger to fire on All Custom Events.
  3. Create four new User-Defined Variables with the Variable type “Data Layer Variable”, with the following Data Layer Variable Names: “eventCategory”, “eventAction”, “eventLabel”, and “eventValue”.
  4. Create a new Universal Analytics Tag.
  5. Set your Tracking ID in your Universal Analytics Tag to the Google Analytics property of your choice.
  6. In your Universal Analytics Tag, select Track Type “Event”
  7. For each Event Tracking Parameter, using the macro selection, input each of the User-Defined Variables that were created in Step 3 to their appropriate slot.
  8. The Tag should have Non-Interaction Hit set to “True”, so that pageviews for ActionTag form interactions are not recorded in duplicate.
  9. Set the trigger for the Universal Analytics tag to the one created in Step 1.
  10. Use the preview setting in the Google Tag Manager container to look at one of your forms to debug and confirm the integration is enabled successfully. Do this by submitting a form and watching (in the Google Tag Manager debugger) for your new Form Events tag to fire successfully.
  11. Via the Data Layer tab in the debugger, inspect the data layer to make sure that the correct information has been passed.
  12. Verify that your data appears in the Google Analytics Events section. Note that it may take up to 24 hours for your data to appear.
  13. Publish the container and ensure that it appears on all pages where ActionTag is present.