Setting up Google Tag Manager and Google Analytics 4

Learn how to set up your GTM to track specific Doc events in GA4

Radovan Vidović avatar
Written by Radovan Vidović
Updated over a week ago

You can use Google Tag Manager (GTM) 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 walk you through setting up your GTM container and checking your tags are firing properly.

1. Set up GTM and GA4

1.1 Set up your GTM container

Follow Google's instructions to create a container in GTM.

1.2 Create your GA4 configuration tag

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.

Add the All Pages trigger so that every page can be tracked in GA4, and then save your tag.

2. Create custom event triggers and tags to track specific events

Next, you will need to set up custom event triggers and tags in Google Tag Manager to track the specific events.

To demonstrate this, 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.

2.1 Create the custom event trigger

Please follow Google's article on creating the trigger.

Note: We recommend using the same name for the trigger and the Turtl event you want to track.

Then, choose the Some Custom Events option to ensure this trigger only fires on a specific event. Set up the Event parameters to equal the event name:

2.2 Create the tag

Next, create the tag you will use to track the event. In GA4, there are four different event types:

  • 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

Follow Google's instructions to set up your tag. Make sure to attach the trigger you have created in step 2.1.

3. Send Turtl the events you want to track

3.1 Send your information to Turtl

Get in touch with your Customer Success Manager or Turtl support and send us the following:

  • GTM container tag from step 1.1

  • The list of event triggers you created in step 2.1

  • The Turtl Docs in which you want to track events

From here our development team will begin working on adding a custom tracking script to your Doc(s).

3.2 Preview your GTM setup

When you receive confirmation the custom tracking script has been added to your Docs, we recommend Previewing the setup in GTM to confirm that the container, the configuration tag, and event tags are firing properly.

In the preview screen, add a link to the Turtl doc with your custom tracking script. You can ensure this has been added to your Doc by checking the Extensions tab in your Doc settings.

In Preview mode, you should see both the GTM Container Tag and GA4 Measurement ID under Google 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.

Next, click through your Doc and complete interactions to check if your event tags are firing. 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 correctly, please make sure that the event name is the same in the trigger/tag and the custom event list from step 2.1.

3.3 View events in GA4

If everything has been set up properly, you will start seeing your events in GA4.

Note: It may take up to 24 hours before you will see this data in GA4.

You can view your reader's events by navigating to the Reports tab, selecting the Engagement drop-down list, and then choosing Events:

If you run into any questions or issues, please reach out to us at or use the live chat.

Did this answer your question?