You can use Google Tag Manager tags to track specific events in Turtl. For example, you can track when a user turns a page of a Turtl Doc or opens the contents menu (for a full list of events, please click here). In this guide, we’ll step through setting up your GTM container and checking your tags are firing properly.
Setting up GTM and GA4
1. Set up your GTM container
First, create a container in GTM (more information on this here). Once you’ve generated your code snippet, copy and paste it into an email to firstname.lastname@example.org. We’ll then add it to all of your Turtl Docs.
Set up your container as in the example below:
2. Preview setup
Next, make sure your GTM container has been configured correctly by selecting Preview mode:
Add the link to your Doc and select ‘Connect’:
Once connected, your Doc will open in a new window. In the Preview window, you should see your GTM container listed in the Google Container Found list. This means your container has been successfully configured.
3. Create your GA4 configuration tag
Next, create a GA4 configuration tag to add the tracking script to your Turtl Docs (find Google’s own documentation here). To create this tag, navigate to the Tags tab and select ‘New’:
Choose the Google Analytics: GA4 Configuration tag type and paste the Measurement ID from your GA4 data stream. This configuration tag will allow us to embed external scripts added to your Turtl Doc and send event data to your GA4 account.
To get your Measurement ID, navigate to Google Analytics and create a new property for the Turtl Doc you want to track (find more information on how to do this here). Once set up, create a data stream and the Measurement ID will be located in the top right corner:
Add the All Pages trigger so that every page can be tracked in GA4 and then save your tag.
Note: make sure to give the tag a descriptive name to make it easier to check on later.
4. Check the preview mode and submit your changes
Check the preview mode to make sure your GA4 configuration tag is set up correctly. Select Preview and enter your Doc URL:
When connected, you should be able to see the GTM Container ID and GA4 Measurement ID listed as Containers found. To check that the GA4 configuration tag is activated, click on the Container Loaded tab and make sure the tag is listed under Tags Fired.
The Container Loaded trigger is the earliest moment when the page has loaded and is equivalent to the All Pages trigger.
If your tag is configured correctly, submit and publish your changes with a descriptive version name:
Create custom event triggers and tags to track specific events
Now that GTM and GA4 are configured, let’s set up custom event triggers and tags to track specific events.
For this example, we’ll set up a trigger and a tag to track when readers play a video in a Turtl Doc. The event name will be Video Plays.
1. Create the custom event trigger
Create a new trigger within the Trigger tab and choose Custom Event as the trigger type.
Next, enter the event name - this should be from the following events that Turtl can track:
- Surf Page Turn
- Immerse Page Turn
- Open Immerse Level
- Close Immerse Level
- Form Fill
- External Link Click
- Internal Link Click
- Poll Submit
- Share Button Click - email
- Share Button Click - LinkedIn
- Share Button Click - Facebook
- Share Button Click - Twitter
- Chart Zoom
- Image Zoom
- Map Zoom
- PDF Zoom
- Video Plays
- Audio Plays
- PDF Download
Then, choose Some Custom Events to make sure this trigger only fires on a specific event. Set up the Event parameters to equal the event name:
Finally, give your trigger a descriptive name and select Save.
2. Create the tag
Next, create the tag so you can track the event. With GA4, there are four different event types you can track (find more information here):
Automatically Tracked Events: collected automatically with basic data collection
Enhanced Measurement: collected automatically if you have enhanced measurement enabled
Recommended Events: events with pre-defined names/parameters that you can enable yourself
Custom Events: events that you enable yourself and create your own names/parameters
To create a Custom Event, navigate to the Tags tab and select New. Then, we’ll choose Google Analytics: GA4 Event from the tag list.
Next, select the GA4 configuration tag you’ve created previously from the drop-down menu and name the event from the list of custom events:
Next, select the trigger you set up earlier and add it to this tag. Finally, save your tag and refresh the page.
3. Preview mode
Before submitting and publishing your changes, we recommend checking the preview mode to make sure your events are firing in your container.
Connect to your Doc and try out the event for the tag you created. You should be able to see the tag firing when clicking on the event. In this example, when we play the video in the Doc, we can see the Video Plays tag firing:
If the tag is not firing during your specific event, please make sure that the event name is the same in the trigger/tag as the event name in the custom event list.
4. View custom events in GA4
Now that your custom event tags and triggers are set up and published in GTM, you will start seeing your events in GA4.
See the events by navigating to the Reports tab, selecting the Engagement drop down list, and then choosing Events:
Note: It may take up to 24 hours after publishing your GTM custom event tags and triggers to see this data in your GA4