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

INP for All Links Click Trigger #709

Open
ChalkTom opened this issue Oct 31, 2023 · 4 comments
Open

INP for All Links Click Trigger #709

ChalkTom opened this issue Oct 31, 2023 · 4 comments
Labels
Enhancement New feature or request

Comments

@ChalkTom
Copy link

There appears to be a separate event listener being added for each event trigger to the body. Where our site has 14 triggers there are 14 event listeners attached to the body of the page that look identical. Where its an “All Links Click” there is about 100 ms being added to each click which is affecting the INP (One of Googles new CWV metrics).
It should be noted that we are using different options for each to trigger the link but that most pages only have 1 - 2 of the total and that the effect is on all links.

@snake14
Copy link
Contributor

snake14 commented Oct 31, 2023

Hi @ChalkTom . Thank you for taking the time to create this issue. Just to make sure I understand the issue, it sounds like you're seeing some performance issues due to the MTM triggers associated with link clicks. Have you tried setting more specific conditions on your triggers and did that help at all? Do you have any specific recommendations?

@ChalkTom
Copy link
Author

ChalkTom commented Nov 2, 2023

Hi @snake14 , each of the triggers are fairly specific and they mock the ones we were using in Google Tag Manager. The differences that I saw were that the Matomo triggers put a separate Event Listener on the the body for each one as well as adding out of the box other types of clicks such as right clicks which also have an event listener per trigger.
The only comparison I have done is with GTM for both their effect on the INP (Interaction to Next Paint) and how they handle event listeners. This may or may not be the reason I am seeing a difference and as I am not intimate with your code base am only guessing but the removal of the code completely gains me around 100 ms (20ms for GTM).
My suggestion would be that if possible only one Event Listener be added and that it should be able to handle all possible triggers for the the "All Links" function.
Cheers

@snake14
Copy link
Contributor

snake14 commented Nov 2, 2023

Thank you for the additional information @ChalkTom . That sounds like a potential enhancement worth investigation. I will mark this issue for our Product team to review and prioritise.

@snake14 snake14 added the Enhancement New feature or request label Nov 2, 2023
@snake14 snake14 added this to the For Prioritisation milestone Nov 2, 2023
@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/each-trigger-all-links-click-seems-to-create-a-separate-event-listener/53603/5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants