Set User ID not working fine

Hi There,

I am using 3.14.0 Matomo version. I have followed the below link and edited the JS code to set the user id

https://developer.matomo.org/guides/tracking-javascript-guide#user-id

I see it is not working as expected.

I see the <nb_users> is not updated, when I derive using the below url, I am trying to fetch the active users

http://localhost/matomo/index.php?module=API&idSite=1&format=xml&method=VisitsSummary.get&period=day&date=today&time=currentTime&token_auth=37fe8388349403c1aa383476b9bf5836
Kindly help me with this

Similar issue here, where calling setuserid after login is not updating realtime, visit log, and user ids

us too. code below. this breaks tracking altogether. am i missing a step.
var x = document.getElementsByClassName(“user”)[0].innerText;
var _paq = window._paq = window._paq || [];
_paq.push([‘setUserId’,]);

Hi,

This is invalid Javascript. Did you maybe mean to write

_paq.push(['setUserId', x]);

Also pay attention to your quotes:
Javascript requires single or double quotes:

'test' or "test"

What you are using are typographic (curly) quotes:

‘setUserId’ and “user”

which are invalid in most programming languages.