I am using Matomo tracking script in Angular 10 app for content tracking - impressions and interactions. For internal links, Matomo script replaces hrefs with tracking link, such as
https://my.domain.com/matomo.php?redirecturl=...... This conflicts with Angular routing and creates a broken user experience.
I am looking for a way to stop treating internal links in a special way and instead track them in a similar way to how external links are tracked - just listen for click event. Furthermore, because the page doesn't reload during navigation, it means these internal links could be tracked without introducing any delay to the user and thus follow the href immediately (Matomo could report the interaction asynchronously).
Currently, the only solutions seems to be to use the
data-content-ignoreinteraction attribute on the
data-content-target element, and track the interaction manually. This however creates a lot of code duplication, as now I have to duplicate a lot of the tracking script to properly find the related elements and
data-content-xxx attributes and duplicate the processing rules to achieve parity with name/target/piece value resolution. Furthermore need to duplicate the click tracking callback etc.
Seems like the tracking script would benefit from adding a new user-configurable settings flag that would stop rewriting internal links to better support single-page apps. Please consider adding this feature, and let me know if there are any interim workarounds I could use today.
Thank you, looking forward to v4.
Also I found a workaround to use in the meantime: