Before setting up events in Google Analytics, you need to make sure that these events also are turned on via the Intento widget config (please get in touch with our Support Team <email@example.com> to guide you). After checks, please follow the steps below to process events via Google Tag Manager.
Add required variables at GTM
1. Visit the tab Variables.
2. Click the “New” button to create a new variable in the “User-Defined Variables” section.
3. Use the Data Layer variable type.
4. Provide a variable name, and put the variable name from event to “Data Layer Variable Name”.
Depending on tracking requirements, you can decide what data should be available at Google Analytics.
// the constant value
tool: "Intento Machine Translation Hub"
// language used when event emitted, in language code format
// full path of the page when the event was emmitted
// number of chars processed by a machine translation provider
// total number of processed chars
// number of chars received from MT Cache/MT Storage
Add custom triggers
1. Go to the “Triggers“ tab and click the “New“ button.
2. Use the Custom Event as the Trigger type.
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.
Depending on tracking requirements, you can choose what events should be available at Google Analytics.
// event will be emitted when the user selects the specific language in the widget
// event will be emitted when the specific page visited and translation requested
// event will be emitted once the portion of the poage content translated
Add custom tags
1. Go to the “Tags” tab and click the “New” button.
2. Specify the tag name, and select a trigger.
3. Specify the event type as “Google Analytics: GA4 Event”.
4. Select the “Configuration Tag”. In “Event Name” you can 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 configured variables.
NB: The trigger/tag approach allows you to change the name of the event and parameters so that you are able to specify how the event will appear at GA4.
Validate and publish changes
1. To validate the configuration, click on the “Preview” button. The list of errors will appear if some of them exist, otherwise, you will be redirected to Google Tag Assistant and will be able to debug the configuration.
2. Click the “Submit” button and publish changes. Once they are published, you can go to GA4 and verify that all events and configured parameters exist.
NB: It is better to use real-time mode for checking since there can be a delay before events are available for analytics purposes.