Tracking WhatsApp button conversion

Hello everyone,
I would like to track the conversion (clicks) for a WhatsApp button that’s available on a website via a WordPress plugin (Click to Chat).
I’ve tried to add this function with the tag and trigger features but when I test it with the Debug tool, nothing happens.
Also, I seen that in the Reports - Outlinks section appear some of the external links, but only a few of them (7 out of 83).
Can someone please guide me to solve this problem?
Thank you very much!

Andi

Hi Andi,

So… I happens I use this plugin for another website I take care of, so I was able to create the steps.

Since the plugin does not have a setting to write data to Piwik PRO, we need to go for a commonly used workaround.

In the config of the Click to Chat plugin, go to Other Settings and select the Google Analytics and Google Analytics 4 is installed option. as written here:
https://holithemes.com/plugins/click-to-chat/google-analytics/

This will create a dataLayer event (Click to Chat) we can use to trigger a custom event via our Tag Manager.

The setup of such a trigger and tag is written here:

Create the trigger:

Create the Custom event tag:

Hook up the trigger to the tag and test it via debug option.
Happy with the setup? Publish it and grab a cup of coffee to celebrate :coffee: :tada:

Cheers,
Richard

Hello,
First of all I would like to thank you for your precious response.

I’ve created the tag and trigger but I have the following problems:

  1. When creating the variable what name should I write in the Data Layer Variable Field? The class name? ctc_chat?
    Here is the code:
<script>
  window.dataLayer = window.dataLayer || [];
  window.dataLayer.push({
    'event': 'Click to Chat',
  });
</script>
  1. Where should I add the code on the website? In the header?
  2. Can I edit the Click to Chat button code? I’m asking because I saw on the page you’ve sent me that I need to edit the button/link
<button onclick="dataLayer.push({'event': ..............});">..........</button>

This line of code is taken from the “About a data layer page”.

Unfortunately I do not have to much experience with coding so maybe you can guide me further with this problem.

Thank you!

The plugin you use creates the dataLayer events, if you select the option GA + GA4, as seen in this image. Just select the two GA options and keep the other two unchecked.

Oh, now I understand.
I will test it out.
Thank you again for your time and guidance!