How can I GET the UserID from matomo via JS? 🧐

Hi all,

I know how to set the UserID ( - but how can I read it via JS?

Ie. if I have a webchat on the page and would like to feed that chat the userid?


You can try to get it via the JavaScript API.


1 Like


When I try this, I get Uncaught TypeError: Cannot read properties of undefined (reading ‘getAsyncTrackers’) !

Please help

I don’t know how else to read the userId that was set on a previous page. I end up creating new userIds every time!

my additions to config.ini as follows:

enable_language_to_country_guess = 0
enable_userid_overwrites_visitorid = 0
trust_visitors_cookies = 1

Thanks in advance!