Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable "replace href" for internal links #16332

Closed
paya-cz opened this issue Aug 21, 2020 · 4 comments
Closed

Disable "replace href" for internal links #16332

paya-cz opened this issue Aug 21, 2020 · 4 comments
Labels
duplicate For issues that already existed in our issue tracker and were reported previously.

Comments

@paya-cz
Copy link

paya-cz commented Aug 21, 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
Copy link
Member

sgiehl commented Aug 21, 2020

Hi @paya-cz.
Thanks for creating the issue. The whole redirect for content tracking will be removed in Matomo 4. See #15406

@paya-cz
Copy link
Author

paya-cz commented Aug 21, 2020

Thank you, looking forward to v4.

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

@paya-cz paya-cz closed this as completed Aug 21, 2020
@tsteur tsteur added the duplicate For issues that already existed in our issue tracker and were reported previously. label Aug 22, 2020
@danemacmillan
Copy link

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
Copy link
Member

sgiehl commented Apr 1, 2021

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate For issues that already existed in our issue tracker and were reported previously.
Projects
None yet
Development

No branches or pull requests

4 participants