Microsoft Clarity - How to record only a part of a website?

195 views Asked by At

Is it possible to setup Clarity so that only a part of a website is recored?

I'm trying to use Clarity on a website that heavily uses iframes therefore the recordings do not bring any value - they're unreadable.

I've tried adding the setup script inside a div, but the whole site is recorded anyway:

  React.useEffect(() => {
    const myDiv = document.getElementById('myDiv');
    if (myDiv) {
      myDiv.appendChild(
        Object.assign(document.createElement('script'), {
          type: 'text/javascript',
          innerHTML: `(function(c,l,a,r,i,t,y){
        c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
        t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
        y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
      })(window, document, "clarity", "script", "<CLARITY-PROJECT-ID>");`
        })
      );
    }
  }, []);
0

There are 0 answers