When the user clicks on the WhatsApp icon/button it creates an event at Google Analytics with some predefined values.
The plugin won’t install Google Analytics on its own.
If Google Analytics 4 is installed
Google Analytics 4 comes with custom event parameters, there is no need to use the predefined parameters like in earlier versions ( Category, Label, Action ).
So we created an option to let the plugin know Google Analytics 4 is installed and like to create events with the new values.
If Google Analytics 4 is installed and Google Analytics 4 option is checked:
- Event: Click to Chat
- number: (the number assigned to the WhatsApp icon/button)
- title: (current page title)
- URL: (current page URL)
If google analytics 4 is installed using a google tag manager, we noticed an issue in creating events. In that case, it is better to create events using the data layer from GTM.
If Google Analtyics installed version is not GA4
- Category: Click to Chat for WhatsApp
- Action: chat: <number>
- Label: <post_title>, <URL>
We can view the events on the Google Analytics Dashboard.
To view the real-time events “Real-Time” -> “Event”.
To view the events “BEHAVIOUR” -> “Events” -> “Overview”.
Google Tag Manager
Method 1: DataLayer (Recommended)
The plugin sends an event to GTM using DataLayer.
- event: Click to Chat
- type: Chat
- number: (the number assigned to that icon/button)
- title: (the current page title}
- URL: (the current page URL)
Using Data layer values, we can create an event in google analytics or other tools installed using a google tag manager.
Method 2: Using the Class name
We can also use Google Tag Manager to create an event with the custom values.
All styles have a class name: ctc-analytics
based on this class name we can create a click event using Google Tag Manager.