Hi,
I’m using ngx-matomo-client in an Angular application, and I’m looking for a reliable way to determine whether matomo.js has been successfully loaded and initialized.
The reason I’m asking is that some users have extensions like uBlock Origin installed, which completely block the Matomo script from loading. In that case, I’d like to detect that Matomo failed to initialize and handle it gracefully.
Is there an official API or property provided by Matomo (or ngx-matomo-client) to check whether Matomo has been initialized successfully?
For example, is there something similar to:
-
A method to check if
matomo.jshas finished loading. -
A property indicating that the tracker has been initialized.
-
A way to verify that the tracker instance is available and ready to receive tracking calls.
Currently, I can check whether a tracker URL is configured, but that doesn’t tell me whether the script was actually downloaded or if it was blocked by an ad blocker.
What is the recommended way to detect that Matomo is fully initialized and ready for tracking?
Thanks!