@paya-cz opened this Issue on August 21st 2020

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.

@sgiehl commented on August 21st 2020 Member

Hi @paya-cz.
Thanks for creating the issue. The whole redirect for content tracking will be removed in Matomo 4. See https://github.com/matomo-org/matomo/pull/15406

@paya-cz commented on August 21st 2020

Thank you, looking forward to v4.

Also I found a workaround to use in the meantime: trackContentInteractionNode API.

@danemacmillan commented on April 1st 2021

Hi @sgiehl

Has this actually been released in version 4? I just upgraded to 4.2.1 from 3.14.1 specifically for this change in behaviour, and all hrefs are still being rewritten. I've read so many tickets and at least one forum post stating that this behaviour has been changed, yet I'm still seeing the old behaviour. How does one activate this new functionality?

@sgiehl commented on April 1st 2021 Member

@danemacmillan That should have been included in Matomo 4. And as far as I know there shouldn't be the need to do anything it should be the default behavior to not do redirects. Is your piwik.js file maybe still cached in some way?

This Issue was closed on August 21st 2020
Powered by GitHub Issue Mirror