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:
Add required Variables at Google Tag Manager
Add custom triggers
Add custom tags
Validate and publish changes
Add Required Variables in Google Tag Manager
To add required Variables at GTM:
Visit the Variables tab in Google Tag Manager:
In the User-Defined Variables section, click New to create a new variable:
Use the Data Layer variable type:
Provide a variable name, and enter the variable name from the event in the Data Layer Variable Name:
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:
Go to the Triggers tab and click the New:
Use the Custom Event as the Trigger type:
Specify the name of the trigger and decide what type of event will emit the trigger by putting it in the Event name field:
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:
Go to the Tags tab and click New:
Specify the tag name, and select a trigger:
Specify the event type as Google Analytics: GA4 Event:
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:
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:
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:
Click Submit and publish changes. Once they are published, you can go to GA4 and verify that all events and configured parameters exist:
It is better to use real-time mode for checking since there can be a delay before events are available for analytics purposes.