Can I track HubSpot chat conversions in a GDPR compliant way?

by Meike Müller

How can you successfully track HubSpot Chat conversions to Google or Matomo while being compliant with the GDPR? The following JavaScript snippet addresses this issue. The problem is that when using CookieMangers, HubSpot Chat is only reloaded after accepting the CookieConsent. So we need to find a way to check for the Consent after loading the chat and then register for the conversationStarted event.

        //functions handles the tracking calls, when the hubspot chat widget is ready
        function onConversationsAPIReady() {
            console.log('hubspot chat now running'); 

            //add listener for a started conversation
            window.HubSpotConversations.on('conversationStarted', payload => {

                //track here
                ga('send', 'event', 'Beacon', 'chat-started', 'Hubspot'); });

        //add listener for accepting the cookies
        window.addEventListener('CookiebotOnAccept', function (e) {

          //maybe check if marketing cookies are allowed
          if ({
              console.log('accept marketing cookies');  

              //now check for hubspot chat widget status
              if (window.HubSpotConversations) {
                console.log('hubspot chat already running'); 
              } else {
                console.log('hubspot chat awaiting'); 
                window.hsConversationsOnReady = [onConversationsAPIReady];
        }, false);

What is Google Analytics anyway?

Google Analytics is a free analysis tool from the Google company. Website operators or app owners can monitor the performance of their online presence and identify potential for improvement. Data such as page views, bounce rates and dwell times are recorded and displayed in statistics or reports. Using Google Analytics leads to website owners finding out whether their pages are working well and which areas still need to be optimized.


What does a Cookie Manager do?

Through a Cookie Manager, you can control cookies and edit them to allow or block cookies on certain web pages. This can always be checked and changed in the Cookie Manager. A Cookie Manager makes sense for you if you want to automate tasks by using a time-saving technology.


What is a Cookiebot anyway?

A Cookiebot is a cloud service that operates in an automated and data protection compliant manner according to global laws such as the DSGVO. With the special deep scanning technology, all trackers and cookies on the website can be detected and controlled. Cookiebot is for you if you want to be 100% privacy compliant.


What is a cookie banner?

A cookie banner must be obtained for consent from website visitors, as third-party vendors are embedded on the website and perform user behavior, etc. there. Website creators must provide visitors with a cookie banner to remain compliant with the global data protection laws of the GDPR.


What does DSGVO mean?

The GDPR (General Data Protection Regulation) is a regulation of the European Union, the aim of the regulation is to make the processing of personal data as safe as possible.


from 06.04.2022

Hello, my name is Meike. I take care of the EXWE back office and am responsible for our social media channels. All of our articles are meant to make your life easier and help you make decisions. Nevertheless, it can happen that something remains unclear, so: If you have questions about this article you can easily reach me at +49 231 93149827.

Show all news (81)

We also have the following interesting posts from our tech blog for you on this topic
Web development and website management - A complete overview

We as a web development agency show you an overview of all website elements. Learn all about SEO, content and website performance and more.

Web development: Does it always have to be Scrum?

Project planning in agile software development - Must Scrum always be used in web development? We make the comparison and show alternative models.

The best programming languages for web development

The best programming languages for web development? We'll introduce you to PHP, Ruby and more, and show you which applications they're best suited for.
+49 231 93149827