Completed appointment bookings can be tracked as custom events in Google Analytics. In order to set up event tracking follow the setup below -
Using Google Tag Manager (GTM)
Pre-requisites :
1. Google Tag Manager Account: Make sure you have a Google Tag Manager account and that you have added the GTM container code to your website.
2. Have a GA4 property setup for the website
3. GA4 Configuration Tag: Make sure you have a Google Analytics 4 configuration tag set up in your GTM container. If you haven't done this yet, create one by going to "Tags" > "New" > "Tag Configuration" > "Google Analytics: GA4 Configuration" and then enter your GA4 measurement ID.
Creating the Data Layer Variable in GTM
If you are an entity without any other practice identifier besides the practice name, you can simply skip the creation of the custom variable.
Navigate to Variables: In Google Tag Manager, go to the "Variables" section from the sidebar.
New User-Defined Variable: Click on "New" under "User-Defined Variables".
Variable Configuration: Click on "Variable Configuration" and choose "Data Layer Variable".
Data Layer Variable Name: Enter the name of the Data Layer key you want to capture. In this example, it would be "label".
Data Layer Version: Usually, you'll use version 2 unless you have a specific reason to use version 1.
Variable Name in GTM: Give your variable a descriptive name so you can identify it later. For example, "CareCru_appointment_Label".
Save: Click "Save" to create your Data Layer Variable.
Setting Up the Tag
1. Create a New Tag: In Google Tag Manager, go to "Tags" and then click on the "New" button.
2. Choose Tag Configuration: Select "Google Analytics: GA4 Event."
3. Configure Tag:
Event Name: Enter an event name like "new_appointment_request".
GA4 Configuration Tag: Choose your existing GA4 configuration tag from the drop-down, or enter your GA4 measurement ID.
Event Parameters: Since you have multiple pieces of data (Action, Category, Label), set up the following key-value pairs:
Parameter Name | Value |
Action | New Appointment Request |
Category | CareCru Online Scheduler |
Label | Click the Lego icon and select the data layer variable you just created in the previous step/ or enter the Practice Code or Practice name |
Setting Up the Trigger
Create a New Trigger: In the "Triggering" section, click to add a new trigger.
Trigger Configuration: Select "Custom Event" as the trigger type.
Event Name: New Appointment Request
(Checkbox for Use regex matching is disabled)This Trigger fires on - Select Some Custom Events
Fire this trigger when an Event occurs and all of these conditions are true -
Event | equals | New Appointment Request |
5. Click Save
Final Steps
Preview and Test: Use GTM's Preview mode to test that the event is being populated correctly and that the GA4 tag is firing as expected
Publish: Once you've verified that everything is working, go ahead and publish the changes.