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

Hi all,

I know how to set the UserID (https://matomo.org/faq/reports/set-up-user-id-tracking-in-matomo/) - 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?

Thanks!

You can try to get it via the JavaScript API.

window.Matomo.getAsyncTrackers()[0].getUserId()

1 Like