I have a single-page application that uses Hotjar. I load the Hotjar javascript as part of the bootstrapper page's scripts:
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:1234567,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
This works fine and I can see recordings of user activity in my Hotjar account.
What I was expecting was some kind of mechanism to stop recording sessions when they withdraw consent. Google Tag Manager supports this, as described at https://developers.google.com/tag-platform/security/guides/consent#implementation_example (note, select the Tag Manager tab, not gtag.js tab).
I cannot find any documentation on Hotjar's website that covers how users can change their consent in a similar way to how Google's consent works.
https://www.hotjar.com/privacy/ mentions consent ("We have built the necessary controls around anonymity and consent...") but in the compliance resources page (https://help.hotjar.com/hc/en-us/sections/360007812474-Compliance) there is no mention of consent whatsoever!
I recognise that I could dynamically load the Hotjar script only once I have confirmed that consent has been provided, but I can't see an elegant way in a single-page application to stop recording if they withdraw consent after the SPA has loaded.
Once the Hotjar script has loaded I can see an hj object in the page which seems to have a fairly rich set of methods and properties. I cannot find these methods or properties documented anywhere.
Is there a way to use the hj object to stop recording dynamically?