Hi,
is it possible to wrap the Image-tracker which JS that on initial Page load the IMG gets requestet and after then, every 5-10 Seconds, same Link? If yes, do i have to add something else for that heartbeat request after initial?
You mixed image tracking with JavaScript tracking. Users with disabled JavaScript are tracket by the first, but not by the second. Please consider that. Only users with enabled JavaScript are tracked by both.
Maybe its a minimal failure by character &? https://xxxxxxx/matomo.php?idsite=xxx&rec=1&ping=1
Further, i think (without knowledge) the rec=1 is not possible by a ping=1. https://xxxxxxx/matomo.php?idsite=xxx&ping=1
thx! Do it has to be &? As i corrected it to & in my second link.
I also had red=1 in mind (to trim / delete it) but i didn’t test.
my goal was to have a heartbeat to track how long visitors are on page and not have 0 seconds everywhere. But i cam to conclusion that, if i use JS for that, i can also just use tracking code JS from Matomo (with Cookie turned off) and i am at same goal, maybe more better ^.- …
I have not enough knowledge for fetch(), but i think by using this with a query string it must be used with URLSearchParams to create a URL query string.
Addition: the Pro of your method is, that by this it is not neccessary to load the matmo.js in the webpages. When the image tracking is enough info for you and you will only expand it to a Time on Page, than use your (fetch) method.