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

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

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 || [];


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.