Setting up click tracking in GA4 with Google Tag Manager

Estimated time to complete: 20 minutes
Requirements: Call Now Button plugin installed, Google Analytics (GA4) implemented through Google Tag Manager

Keep reading if you’ve implemented Google Analytics via Google Tag Manager. This article describes step by step how to set up Event Tracking with Google Tag Manager to reveal in Google Analytics how many people click the Call Now button on your website.

High level overview of the steps involved

(Steps are described in more detail below.)

Step 1

Enable the required click variable in Google Tag Manager

Step 2

Create 2 custom variables for the actions

Step 3

Creating the Trigger in Google Tag Manager

Step 4

Creating the Tag in Google Tag Manager

Step 5

Publish your changes in Google Tag Manager


OK, let's sign into your Google Tag Manager account and get started!

Step 1: Enable the required click variable in Google Tag Manager

Before you set up the actual event you need to enable the build-in variable for tracking clicks on an element with a specific class name.

  1. Click on Variables in the menu on the left side of the screen:
    Google Tag Manager - Variables in the side menu.
    Google Tag Manager - Variables in the side menu
  2. Click Configure
    Tag Manager - Configure Built-in Variables
    Tag Manager - Configure Built-in Variables
  3. Scroll down to the Clicks section and select Click Classes.
    Google Tag Manager - Enable Click Classes variable
    Google Tag Manager - Enable Click Classes variable

Step 1 done!

Step 2: Create 2 custom variables for the actions

The custom variable for the Action type

  1. Again open the Variables section from the previous step and now scroll down to the User-Defined Variables:
    GTM - The user-defined variables
    GTM - The user-defined variable
  2. Click New and name the new variable NowButtons action.
  3. Click on the pencil that appears when you hover over the Variable Configuration box.
  4. In the Choose variable type panel that appears, select Data Layer Variable.
  5. In the field called Data Layer Variable Name enter the following: gtm.element.dataset.actionType and click Save.
    GTM - Create a custom variable for the button action
    GTM - Create a custom variable for the button action

The custom variable for the Action label

  1. If you're not in the Variables section anymore, open it again and scroll down to the User-Defined Variables
  2. Click New again to create another variable and name it NowButtons label.
  3. Click on the pencil that appears when you hover over the Variable Configuration box.
  4. In the Choose variable type panel that appears, select Data Layer Variable again.
  5. In the field called Data Layer Variable Name enter the following: gtm.element.dataset.labelText and click Save.
    GTM - Create a custom variable for the button label
    GTM - Create a custom variable for the button label

That's step 2 done!

Step 3: Creating the Trigger in GTM

  1. Now click on Triggers in the left side menu:
    GTM - Creating a Trigger
    GTM - Creating a Trigger
  2. Click New
    Google Tag Manager - Building a new Trigger
    Google Tag Manager - Building a new Trigger
  3. Give your new Trigger a name: NowButtons clicks and click the pencil (appears when you hover over the box) in the top right corner:
    Google Tag Manager - New Triggers
    Google Tag Manager - New Triggers
  4. Under Choose trigger type select Just links:
    Google Tag Manager - Clicks Just Links.
    Google Tag Manager - Clicks Just Links
  5. Under This trigger fires on select Some link clicks. Then from the pull-down menu select the variable you’ve just enabled: Click Classes, change the second pull-down to contains and in the empty field you enter cnb-action
    Google Tag Manager: trigger settings
    Google Tag Manager: trigger settings
  6. Click Save to store your new Trigger.

That's step 2: DONE!

Step 4: Creating the Tag in GTM

  1. Click on Tags in the left side menu:
    The Tags setting is located in the left side menu of Google Tag Manager (GTM)
    The Tags setting is located in the left side menu of Google Tag Manager (GTM)
  2. Click New:
    Google Tag Manager - Creating Tags in GTM
    Google Tag Manager - Creating Tags in GTM
  3. Give your new Tag a name: NowButtons click tracking and click the pencil (appears when you hover over the box) in the top right corner:
    Google Tag Manager - New Tags
    Google Tag Manager - New Tags
  4. At the top of the Choose tag type panel that appears, select Google Analytics: GA4 Event.
  5. Via the Configuration Tag pull down you select your GA4 Measurement ID. If you previously created a variable for that, you can select it here. Or select None - Manually Set ID and enter the Measurement ID in the field that appears below it.
  6. In the Event Name field, enter NowButtons click
  7. Open the Event Parameters section and enter the following information:
    • Parameter Name: action_type and in the Value field click on the lego brick and select the NowButtons action variable you created in step 2
    • Parameter Name: action_label and in the Value field click on the lego brick and select the NowButtons label variable you created in step 2
    • Parameter Name: action_value and in the Value field click on the lego brick, click on the Built-ins button in the top right corner and click on Click URL

    The whole window should look something like this this:
    Google Tag Manager: GA4 Event Tracking tag settings
    Google Tag Manager: GA4 Event Tracking tag settings
  8. Now in the window below called Triggering click the pencil:
    Google Tag Manager - triggering the tag
    Google Tag Manager - triggering the tag
  9. In the Choose a trigger window select the Trigger you created in step 2 called NowButtons clicks.
  10. Click Save and you’re all set.

Step 5: Publish your changes in GTM

The final step is to publish your work in Google Tag Manager and you're all set!

Once this is live you should see the clicks on any of the NowButtons appear in your Google Analytics account under Reports > Engagement > Events:

Google Analytics (GA4) - Finding your events
Google Analytics (GA4) - Finding your events