clarity: Custom identify `user id` not being used
We’ve manually integrated Clarity in the <head>
of our website. When a logged-in user is present, we use window.clarity('identify', '*');
to submit their numeric account ID as a string. Like this!
<script>
(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");
window.clarity('identify', '7654321'); // Example 7-digit ID as on the site
window.clarity('set', 'Page Type', "Example");
window.clarity('set', "Account ID", "7654321");
window.clarity('set', "User Type", "Example");
</script>
This custom identifier doesn’t seem to be used on clarity.microsoft.com or searchable by the User ID
filter. Instead, we see the auto-generated User ID
s (like 8p6jh3
).
What are we doing wrong here? Or does the feature not operate as we imagine?
We’ve attempted to work around this issue with the Account ID
custom filter as you can see above, but because those filters cannot be copy + pasted and only seem to accept up to three characters, it makes it impractical for our purposes. (This particular use case is for support and engineering to better debug issues that happen.)
CC: @markb423 / @soundslocke
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 27
- Comments: 46
@NegTakashiro , please verify that the user id you’re passing to Clarity is valid. Clarity requires that user ids be a string of no more than 255 characters. Additionally, Clarity will not accept user ids that contain certain characters, such as <, >, and &. If you’re passing an invalid user id, Clarity may not be able to use it.
I have got the same issue. I seem to be making the right calls but the user_id that I am providing is not being respected.
@johnbacon , at first I taught that consent might have been required for you to use “identify” but I am calling consent and user_id is still not respected.
I am using Clarity in a React app where the tracking code is loaded in “<head>” and then I call consent and identify in one of my components. I am also trying to set some addition data that is needed in my context but it is not recorded as well. Here is the simplified version:
window.clarity('consent'); window.clarity("identify", "myuserid"); window.clarity("set", "domain", "mydomain");
What I have noticed looking at the source code of Clarity is that there is a check for “active()” - when false, operations like identify will not do anything. So I am wondering the call to identify is called a bit too early.
Any suggestions are welcome.
I was able to use
Custom user ID
, but after some tests, I realized that the filter on the dashboard only works after about 2 hours. I’m using Google Tag Manager to load clarity into my platform, and when users sign in to your account, I’m triggering the API to identify the user.You can also use the
Custom Tags
to try to identify the users. Here is a similar implementation using the custom tags.But keep in mind that the data might take some time to get available on the dashboard and it’s good to wait at least 2 hours to try to see the data on there.
References
https://learn.microsoft.com/en-us/clarity/setup-and-installation/clarity-api https://learn.microsoft.com/en-us/clarity/setup-and-installation/identify-api
I have this on my webpage:
window.clarity('identify', 43)
But if I filter for that identifier, this is the result:
I also tried
window.clarity('set', 'myuserid', 43)
but I can’t see any custom tag dropdown select:We are encountering the same issue as well. We cannot get the identify property to work. This is a big issue for us because the distinct user count is way off. Any input from the clarity team would be greatly appreciated.
Can anyone confirm that this solution worked for them?
@ClaritySupport if you are official support then you should really be a marked as a contributor to this repo. Otherwise it just looks really suspicious as your profile is blank with zero permissions.
@sarveshnagpal Can you confirm this please?
@johnbacon, Yes we are official Clarity support. Sorry for the confusion. Any id that you sent us via identify API, you can enter it in the Custom user ID filter within the Custom filters section.
A single page can have no more than 128 tags. Any other tags will be ignored.
We’ve recently experienced this problem also, any updates?
Any updates?
@ClaritySupport why is that my promise returns everything correctly, but on clarity I don’t seem to find the custom user id and custom session id filters in recording
@Ahl-am , user email should be in double quotes, window.clarity(“identify”,“useremail”), for more details please refer https://learn.microsoft.com/en-us/clarity/setup-and-installation/identify-api
@santilorenzo Have you tried to make it a string?
window.clarity('identify', '43')
?@ClaritySupport – as @straxico mentioned, this is unfortunately not an acceptable solution.
Are you official Clarity support?
@johnbacon ,Please use Custom user ID under Custom filters instead of user ID, Custom Tags in Clarity.
+1
Any updates on this?