clarity icon indicating copy to clipboard operation
clarity copied to clipboard

How to stop clarity tracking conditionally?

Open M7m00d opened this issue 1 year ago • 2 comments

I am working on a React/Next.js project and I have some sensitive user-pages that I want to stop Clarity to track them.

I call this before redirecting the user to the sensitive page

window.clarity('stop')

And call this when the user leaves the page.

window.clarity("consent");
window.clarity("start", {
projectId: CLARITY_ID_HERE,
upload: "https://m.clarity.ms/collect",
track: true,
content: true,
cookies: [],
});

The stop call works well, but the start snippet doesn't resume or restart the interaction tracking.

Am I missing something here? Also, what's the difference between pause, stop, resume, pause, and start? I couldn't find a reference for them in the documentation.

M7m00d avatar Feb 18 '24 10:02 M7m00d

I'm thinking stop just ends the recording. To me it makes the most sense to use pause and resume instead to avoid recording sensitive info.

It does sound like the documentation needs improving. Using the words stop, resume, pause, and start is kind of confusing to me I will say since I was thinking about how a DVD player worked. Maybe Microsoft should rename stop to endRecording if that is what stop is supposed to do, because the word 'stop' almost implies you can 'go' at a later point.

M-Valentino avatar Apr 03 '24 03:04 M-Valentino