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 how to check for the Consent after loading the chat and then register to the conversationStarted event.

Reading time 2 min


//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.


FAQ: Questions and answers about HubSpot

If you still have questions about HubSpot, you can find some frequently asked questions and the corresponding answers or explanations here. Do you have a specific question or need help with HubSpot? Then don't hesitate to contact us. We're here to help you with your digital projects.

  • What does a cookie manager do?

    A Cookie Manager allows you to control cookies and edit them so that cookies are allowed on certain websites, or so that they are blocked. This can always be checked and changed in the Cookie Manager. A Cookie Manager makes sense for you if, among other things, you want to automate tasks 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. The Cookiebot is then something 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 the GDPR mean?

    The GDPR was introduced on May 25, 2018 and applies to all companies that process personal data of EU citizens, regardless of where the company is located. The Regulation sets a high level of data protection for all personal data and establishes stricter requirements for the processing of personal data.

    The regulation requires companies to set out their privacy policies in a clear and understandable way for users. Companies must also ensure that user data is only processed for the stated purpose and that they take appropriate measures to protect the data.

    In addition to the GDPR, there are standard contractual clauses developed by the European Commission to facilitate the cross-border movement of personal data. These clauses are used by companies to ensure that data protection requirements are met when personal data is transferred from one country to another.

    Companies must also ensure that they take appropriate technical and organizational measures to protect personal data, including complying with data protection policies and implementing appropriate security measures. If a company violates the GDPR, it can be subject to heavy fines.

  • What is data protection authority and what are its tasks?

    A data protection authority is an institution responsible for monitoring and enforcing data protection laws. Each country has its own data protection authority, which is responsible for ensuring compliance with data protection laws within the country. In the European Union, there is also the European Data Protection Authority, which is responsible for coordinating data protection authorities in EU member states.

    The main tasks of a data protection authority include monitoring and enforcing data protection laws, advising and assisting businesses and citizens on data protection issues, investigating data protection breaches, imposing fines and penalties on companies that have violated data protection laws, and cooperating with other data protection authorities at the national and international level.

    The specific tasks of a data protection authority include reviewing privacy statements and the data protection practices of companies, monitoring data processing operations, authorizing data transfers to third countries, investigating data protection breaches, and advising companies and citizens on data protection issues

Was ist dein Projekt? Wenn du uns darüber erzählen möchtest, rufen wir dich zurück!

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.

Du möchtest immer am Zenit der Technik bleiben? Keine News und Blogbeiträge mehr verpassen.
We also have the following interesting posts from our tech blog for you on this topic
Reach your users with web apps and push messages!

Push notifications in the form of web apps help you get closer to your business goals. Find out why you shouldn't do without them here.

What is front-end & back-end programming?

Programming and web development consists of frontend, middleware and backend development. In our blog article you can find an overview.

Website Promotion - What is involved?

For a successful website you need online marketing measures like push & pull marketing, social media ads and SEA - Here you can find an overview!
+49 231 93149827