My application has a link that goes to an URL like
https://anotherwebsite.org/id?q=12345 which my app will replace the query parameter to a user input. As user input, the parameter is should not be collected. I intended to replace the tracked link as
There seems no easy way to achieve that. The documentation only mentions how to use CSS classes to classify the link as a outlink, and the JS method to call to count an outlink.
The first description does not fit my use case.
The second description, in my case, asks me to turn my link into
<a href="https://anotherwebsite.org/id?q=12345" target="_blank" onClick="_paq.push(['trackLink', 'https://anotherwebsite.org/id?q=%3Cnumber%3E', 'link']);">Link</a>
Will likely to cause the link to be tracked twice, although I didn't try to verify if that's really the case (see note below).
I figured I could avoid that by opt-out from link tracking on the link and call the JS method myself, like
<a href="https://anotherwebsite.org/id?q=12345" target="_blank" class="matomo-dont-track" onClick="_paq.push(['trackLink', 'https://anotherwebsite.org/id?q=%3Cnumber%3E', 'link']);">Link</a>
but such option does not exist (unless not explained on the doc).
How do I achieve the desired effect with Matomo? Please let me know if this is actually possible; if so I we should classify this issue to a documentation one.
Note: I am not sure how to test this out without polluting my production dataset. Mamoto can avoid duplicate tracking by making sure
trackLink is only register once per
MouseEvent event loop, but that's unlikely.
@timdream you can give your link a class
ignore and then track the click manually using
onclick. This way Matomo will ignore it and you won't track it twice. If you prefer to use another class name you can configure alternatively different class name like
Got it. Thank you very much. I should have read the documentation section to the end.