How to set up an event tracking in Google Analytics

Before setting up events in Google Analytics, you need to make sure that these events are also turned on via the Intento widget config (please get in touch with our Support Team <support@inten.to> to guide you). After checks, please follow the steps below to process events via Google Tag Manager.

To set up event tracking in Google Analytics: 

  1. Add required Variables at Google Tag Manager

  2. Add custom triggers

  3. Add custom tags

  4. Validate and publish changes

Add Required Variables in Google Tag Manager

To add required Variables at GTM:

  1. Visit the Variables tab in Google Tag Manager:

    1 - Visit the tab Variables.png
  2. In the User-Defined Variables section, click New to create a new variable:

    2 - User-Defined Variables.jpg
  3. Use the Data Layer variable type:

    3 - Use the Data Layer variable type.png
  4. Provide a variable name, and enter the variable name from the event in the Data Layer Variable Name:

    4 - Data Layer Variable Name.png

Depending on tracking requirements, you can decide what data should be available in Google Analytics:

// the constant value tool: "Intento Machine Translation Hub" // language used when event emitted, in language code format language: "en" // full path of the page when the event was emmitted page: "inten.to" // number of chars processed by a machine translation provider translated: "4556" // total number of processed chars processed: "4600" // number of chars received from MT Cache/MT Storage reused: "44"

Add Custom Triggers

To add custom triggers:

  1. Go to the Triggers tab and click the New:

    5 - click the New button.png
  2. Use the Custom Event as the Trigger type:

    6 - Use the Custom Event as the Trigger type.png
  3. Specify the name of the trigger and decide what type of event will emit the trigger by putting it in the Event name field:

    7 - event will emit the trigger by putting.png

Depending on tracking requirements, you can choose what events should be available in Google Analytics:

// event will be emitted when the user selects the specific language in the widget select_translation_language // event will be emitted when the specific page visited and translation requested visit_translated_page // event will be emitted once the portion of the poage content translated translate_page_content

Add Custom Tags

To add custom tags:

  1. Go to the Tags tab and click New:

    8 - Tags tab and click the.png
  2. Specify the tag name, and select a trigger:

    9.png10.png
  3. Specify the event type as Google Analytics: GA4 Event:

    11.png
  4. Select the Configuration Tag. In Event Name, specify the name. The event will be emitted at GA4 with that name, the same as Event Parameters. To send the specific variable to the event parameter, select it from the configured variables:

    12.png13.png

The trigger/tag approach allows you to change the name of the event and parameters so that you can specify how the event will appear at GA4.

Validate and Publish Changes

To validate and publish changes:

  1. To validate the configuration, click Preview. The list of errors will appear if any exist, otherwise, you will be redirected to Google Tag Assistant and will be able to debug the configuration:

    14.png
  2. Click Submit and publish changes. Once they are published, you can go to GA4 and verify that all events and configured parameters exist:

    15.png

It is better to use real-time mode for checking since there can be a delay before events are available for analytics purposes.