Has there been a recent update with Microsoft Clarity identifiers?

555 Views Asked by At

When I wrote this code, it was working, and I could see a custom identifier on Microsoft Clarity with the preferred username of the user. However, now I only get a random alphanumeric string rather than the username. Perhaps there has been a new update in the last couple weeks that changed the way Clarity identifiers work?

private applyIdentifier() {
    const myId = this.userInfo?.preferredUsername;
    if (myId) {
      const clarity = (window as any)['clarity'] as any; 
        clarity('identify', myId);
    }
  }

I also have this generic Clarity function. Perhaps I should set the identifiers there?

(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', 'abcd1234');

As I mentioned before, this code was working a couple weeks ago, and isn't anymore.

1

There are 1 best solutions below

0
On

Clarity securely hashes the custom-id on the client before being sent to Clarity servers.For an optimal user tracking, the Identify API should be called for each page of the website even though you are not passing a custom-session-id or custom-page-id.For more details please refer Identify API