Hello there @user10724
Thank you for waiting!
Our devs have double-checked things and recommended replacing the previous code with the new one:
const openChatBtn = document.querySelector(
'[class*="Bubble__BubbleComponent"]'
);
const startChatBtn = document.querySelector(
'[class*="ChatButton__DefaultButtonComponent-sc"]'
);
if (!dataLayer || !openChatBtn || !startChatBtn) {
return;
}
openChatBtn.addEventListener('click', () => {
dataLayer.push({ event: 'open-or-close-whatsapp-chat' });
});
startChatBtn.addEventListener('click', () => {
dataLayer.push({ event: 'click-start-chat-button' });
});
If I understood right, under the “variables” you mean the events that will be sent to your GTM account. Here are the events that will be sent:
-
clicks on the Open/Close chat
-
clicks on the Start Chat button
After you’ve added the code above to the Custom JS section, you need to create triggers for these events:
Please let me know if it helped