Tracking Calendly events in Google Analytics 4 (GA4) using Google Tag Manager (GTM) is essential for gaining insights into user interactions with your scheduling tool.
Calendly includes built-in Google Analytics 4 tracking, but this feature isn't accessible for free users.
However, there's a workaround to track Calendly events.
This guide will show you how to track it using Google Tag Manager (GTM) with a free Calendly plan.
Before you begin, ensure you have the following:
Ensure you have access to your website's Google Tag Manager account. If you don't have one, set it up before proceeding.
Have an active Calendly account with events set up for users to schedule.
Create a Google Analytics 4(GA4) property for your website in Google Analytics. If you don’t have a GA4 for your website, follow the instructions on the Google Analytics platform.
Let's dive into the steps to track Calendly events in Google Analytics 4(GA4) using Google Tag Manager(GTM)
Before we get into the details of how to track Calendly events, let's first acknowledge the variety of events we can monitor using Google Tag Manager (GTM).
Understanding these events is crucial for crafting a strong tracking strategy and gaining insights into user interactions.
Let’s see what are those events and how they can help.
Event Name: `profile_page_viewed`
Description: When someone views the event-type page( When someone opens the embedded calendly page or when it loads for the first time).
Event Name: `event_type_viewed`
Description: When someone views the event type page or clicks on an event type.
Event Name: `date_and_time_selected`
Description: When the invitee selected the date and time.
Event Name: `event_scheduled`
Description: When the invitee successfully booked a meeting.
<script>
window.dataLayer = window.dataLayer ||[];
window.addEventListener('message',
function(e) {
if (e.data.event && e.data.event.indexOf('calendly') === 0) {
window.dataLayer.push({
'event': 'calendly',
'calendly_event': e.data.event.split('.')[1]
});
}
}
);
</script>
This code listens for messages related to Calendly events on a website.
When it detects such a message, it stores information about the specific Calendly event in the data layer.
You can use this information to track, analyze, or integrate with other tools.
In calendly, the above code tracks one of the four events -
For triggering, select "On All Pages" to ensure the tag functions universally across your site.
Assign a name to the tag, such as "Calendly Custom HTML," and save the tag.
Click the preview button to confirm whether it is working.
Then, enter your website URL in the field and click Connect.
Upon connection to the website, a preview and debug window will open. It is the tag assistant and will open in a separate window.
Now, go back to the calendar and schedule a meeting.
Head to GTM preview mode, and you can see something similar. Expand the API Call to see the full details.
Here, event_scheduled is a calendly event pushed by the listener.
If you don't see the events in the preview mode, it means there's a connection problem. To fix this, just close and reopen it.
By following the steps, the code will work smoothly on every page.
Go to "Triggers," then select "New." Choose "Custom Event" as the trigger type in the trigger configuration.
Set the Event Name as "calendly" and the Trigger Name as "Calendly-Custom." Click on "Save" to finalize the trigger configuration.
A dataLayer variable in Google Tag Manager helps pass and organize data between your website and GTM, making it easy to track events, define custom variables, and customize your tracking setup.
Let’s see how to create a Data Layer Variable -
Go to the "Variables" section. Within user-defined variables, create a new variable.
Click anywhere in the variable configuration, then choose the data layer variable option.
Name the data layer variable as "calendly_event" and save it with "Calendly-datalayer."
In the provided code, "calendly_event" is the parameter sent to the data layer.
If you already have the Google Tag and Measurement ID, skip to step 7.
Log in to your Google Analytics account using the associated Google account.
Choose the relevant Google Analytics account and property for your website.
Access the Admin tab in the lower-left corner to enter the Administration page.
Under the data collection and modification section, select "Data Streams."
Click on the data stream associated with your website.
Find the Measurement ID in the Data Stream settings, typically displayed as a series of numbers preceded by "G."
- Copy the Measurement ID to your clipboard for configuring the GA4 tag.
The Google Tag serves to store the Measurement ID within the container.
The Google Tag identifies the presence of the Measurement ID when it is used anywhere in the container. In this case, to create a GA4 tag.
Once you create the Google Tag, you can use it multiple times.
Let’s create a Google Tag -
Navigate to the "Tags" section and click "New" to create a new tag.
Choose "Google Tag" as the tag type in the configuration options.
- Paste your Measurement ID in the "Tag ID" field to link it to the Google Analytics 4 property.
- Configure the triggering section to activate the tag on all pages.
Click "Save Tag" to preserve your configuration and give the tag a meaningful name.
To create the GA4 tag, go to "Tags," click "New,"
Select Google Analytics in the tag configuration and choose "Google Analytics: GA4 Event."
Paste the Measurement ID and confirm it is available in the container.
Use "calendly_{{Calendly-datalayer}}" as the event name based on the data layer variable created in step 5.
We have two components in the event name: firstly, "Calendly," which we named, and secondly, "{{Calendly-datalayer}}" as the data layer variable – these represent the event types.
This structure aids in recognizing the specific Calendly event occurring on your website.
For instance, the event name could be "calendly_date_and_time_selected" or "calendly_profile_page_viewed." Other possible events include "calendly_event_type_viewed" and "calendly_event_scheduled."
These event names help identify which event occurred on your website.
In the triggering section, select the previously created Calendly-Custom trigger. We created this trigger in step 4.
Save the GA4 tag as “GA4 Event - Calendly Event".
Submit the changes by clicking the "Submit" button in the top right corner and providing the necessary details for submission.
By following these steps, you'll smoothly incorporate your Measurement ID into a tag, ensuring effective tracking of the "GA4 Event - Calendly Event" event on your website.
After creating a GA4 tag, the changes are not visible in the preview mode.
To see the changes you made to the new GA4 tag- Close the preview mode and open it again by clicking the preview button in the top right corner.
A separate page with Calendly will open and schedule an event.
Go back to the Tag Assistant window. Click "Calendly," and you'll see "GA4 Event - Calendly Event" fired.
Now the GA4 event is configured and firing, it’s time to see the Calendly events.
To see them, go to Google Analytics > Admin > Data display and choose Debug View.
In the Debug View, you can see the events.
Once you are okay with everything, hit submit to save all the changes and provide the necessary details for the submission.
This guide outlines the steps to track Calendly events in Google Analytics 4 (GA4) using Google Tag Manager (GTM) for users on the free Calendly plan.
The process involves creating event types, implementing a Calendly listener code in GTM, and configuring custom triggers and variables.
Additionally, it explains how to create a GA4 tag to store the Measurement ID and track Calendly events effectively.
It emphasizes the importance of testing the setup using the preview mode and provides insights into checking events in Google Analytics Debug View.
Join 70+ successful B2B SaaS companies on the path to achieving T2D3 with our SaaS marketing services.