Tracking users in your campaigns through GTM using button clicks and Google Analytics 4 (GA4) events is a very effective way of gathering data. In this article, we will guide you through the process of creating a GA4 event in Google Tag Manager when a user clicks on a button with the ID “linkedinbtn.”
In this article you will learn how to:
Set up GTM with Playable through your GTM-ID
Give a button in Playable a trackable ID
Create a GA4 Event Tag
Create a Trigger step in GTM
Publish and test your button and tracking
Setting up Google Tag Manager
You can add your Google Tag Manager ID to the platform under Account. First, go under the tab “Admin”, then select “Developer” and in the sub-menu, click on “Scripts”.
Enable google tag manager and add your ID.
Select the button you want to track
In the frontend editor, select the button you want to track. Under the Content tab add a Button ID, this will be used later when setting up the trigger in GTM. In this example the Button ID is "linkedinbtn".
Creating a GA4 Event Tag:
From the left-hand menu in Google Tag Manager, go to the “Tags” section.
Click on the “New” button to create a new tag.
Give your tag a descriptive name, such as “GA4Event”
Under the “Tag Configuration” section, select “Google Analytics: GA4 Event” as the tag type.
Configure the tag as follows: Event Name: Enter a unique name for the event, such as “LinkedIn Button Click.”
Create a Trigger in Google Tag Manager
Log in to your Google Tag Manager account and navigate to your container.
Go to the “Triggers” section from the left-hand menu.
Click on the “New” button to create a new trigger.
Give your trigger a descriptive name, such as “LinkedIn Button Click.”
Under the “Trigger Configuration” section, select “Click” as the trigger type.
In the “Some Clicks” section, click on the pencil icon to edit the trigger configuration.
Choose “Click ID” as the condition.
Set the condition to “contains” and enter the ID of your LinkedIn button (“linkedinbtn”).
Save the trigger.
Publishing and Testing
Click on the “Submit” button in the upper-right corner of the Google Tag Manager interface.
Add a descriptive version name and description for the container version.
Review the changes and click on the “Publish” button to make your changes live.
Test the implementation by visiting the webpage with the LinkedIn button and clicking on it.
Open the Google Analytics 4 interface and navigate to the “Events” section to verify that the LinkedIn Button Click event is being tracked correctly.