Hide Or move hubspot chat on mobile

Hi @kvlschaefer and @Chris_AU,

So here’s a pretty simple trick to hide the chat using GTM :

1. Create a javascript variable, edit the breakpoints to match yours and name it screenWidth :

function () {
 var screenWidth = window.innerWidth;
 var screenType;

// edit the breakpoints to match yours
 const mobileBreakpoint = 420;
 const tabletBreakpoint = 1024;

 if (screenWidth <= mobileBreakpoint) {
 screenType = "mobile";
 } else if (screenWidth <= tabletBreakpoint) {
 screenType = "tablet";
 } else {
 screenType = "desktop";
 }
 return screenType;
}

2. Create a specific trigger for your Hubspot chat custom HTML tag and use the previsouly created variable as a condition.

Example if you want to fire the tag on all pages for desktop only :

If you still want to display the widget but move it up a notch, you will find the solution here.

It’s pretty hacky and I would much rather hide the chat on mobile devices, but iot does work and will achieve what you want.

Hope this helps !
If it does, please consider marking this answer as a solution :slightly_smiling_face:

Best,

Ludwig