Are custom variables meant to only be set on page load? It seems the values are only tracked if you set them BEFORE trackPageView. If I want to set a custom variable after a user action, I’d then have to track another page view, which would doesn’t seem right…
That’s correct, Custom Variables of scope “page” are associated with a given pageview. So it’s needed to track another pageview for this custom variable. Btw, you could also send an “Event” rather than a pageview, so it does not appear in your Page URls report. see: trackEvent()
Thanks for the response! Why is there no mention of trackEvent in the JavaScript API documentation? JavaScript Tracking Client: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3
Where can I find more info about it?
it’s only partly documented, because the ticket is still opened Custom Events analytics, event tracking · Issue #472 · matomo-org/matomo · GitHub
Excellent, thank you for your help!