You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I just want to count clicks on an internal link. This works with "trackContentInteractionNode". But there are problems.
If the Matomo script with "trackContentInteractionNode" is in the <head>, Matomo will not work because there is an "is not defined" message.
document.getElementById("aid").addEventListener('click', function () {
_paq.push(['trackContentInteractionNode', this]);
});
The element "document.getElementById("aid")" does not exist when the Matomo script is loaded with "trackContentInteractionNode" in the <head> in the browser (Firefox 57.0.4).
For "trackContentInteractionNode" the Matomo script must be at the bottom of the . But then the Matomo script does not work either, because at least one <script> element must already exist in the head because of the "insertbefore". There is no "if </script>" in head check" in the Matomo Script. If no "</script>" is in the , then a document.getElementsByTagName("head")[0] .appendChild must be used.
The text was updated successfully, but these errors were encountered:
Then it doesn't matter where you add the code, it will only be loaded after the all elements exist.
That snipped also doesn't need to be at the same place as your piwik tracking code. You can add it to the bottom or add it to the rest of your website Javascript.
PS: For general questions that aren't specific bugs in Matomo, please ask on the forum: https://forum.matomo.org/
The code on the developer page is correct. How it needs to be integrated into the website and what exactly it should do, depends on the website where you want to use it.
Hello, I just want to count clicks on an internal link. This works with "trackContentInteractionNode". But there are problems.
If the Matomo script with "trackContentInteractionNode" is in the
<head>
, Matomo will not work because there is an "is not defined" message.The element "document.getElementById("aid")" does not exist when the Matomo script is loaded with "trackContentInteractionNode" in the <head> in the browser (Firefox 57.0.4).
For "trackContentInteractionNode" the Matomo script must be at the bottom of the . But then the Matomo script does not work either, because at least one <script> element must already exist in the head because of the "insertbefore". There is no "if </script>" in head check" in the Matomo Script. If no "</script>" is in the , then a document.getElementsByTagName("head")[0] .appendChild must be used.
The text was updated successfully, but these errors were encountered: