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

Update documentation how heart beat timer works #15612

Closed
Findus23 opened this issue Feb 23, 2020 · 8 comments · Fixed by matomo-org/developer-documentation#334
Closed

Update documentation how heart beat timer works #15612

Findus23 opened this issue Feb 23, 2020 · 8 comments · Fixed by matomo-org/developer-documentation#334
Labels
c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base.
Milestone

Comments

@Findus23
Copy link
Member

#15058 made it work more efficiently, but now it isn't intuitive anymore as one can't see it do its thing when just quickly testing the website.

Therefore at least https://developer.matomo.org/guides/tracking-javascript-guide#accurately-measure-the-time-spent-on-each-page and maybe also related FAQs need to be updated to properly describe how it works and how to test if it is set up correctly.

@Findus23 Findus23 added the c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base. label Feb 23, 2020
@Findus23 Findus23 added this to the 4.0.0 milestone Feb 23, 2020
tsteur added a commit to matomo-org/developer-documentation that referenced this issue Feb 23, 2020
@tsteur
Copy link
Member

tsteur commented Feb 23, 2020

tsteur added a commit to matomo-org/developer-documentation that referenced this issue Feb 23, 2020
* Document changed behaviour of heartbeat timer

fix matomo-org/matomo#15612

* Update docs/3.x/tracking-javascript-guide.md

Co-Authored-By: Lukas Winkler <git@lw1.at>

Co-authored-by: Lukas Winkler <github@lw1.at>
@sigtm
Copy link

sigtm commented Jul 27, 2020

Sorry to bring up this old issue @tsteur, but it is still unclear to me if/how Live.getCounters was affected by the new heartbeat logic. In our app I can see that if I leave a tab open and in focus, our live counter goes back to 0 after a while if I don't do anything. This is with the heartbeat timer enabled.

I seem to remember that the old heartbeats would also keep you counted as a live visitor until you left the page/tab, but I am not 100% sure. Am I just imagining things?

If this is as intended, I would love it if the docs mentioned how the heartbeat timer relates to the numbers given by Live.getCounters. Is the idea that we have to manually send ping requests to keep extending the visit, if we rely on the live counter? And if we do, is the heartbeat timer still needed (for our use case)?

@tsteur
Copy link
Member

tsteur commented Jul 27, 2020

@sigtm this was changed a few years ago already AFAIK. We're not updating the visit time when a ping request is set as many people ended up having visit lengths of several hours because the visit basically never expired. If you wanted that behaviour you could try this with a custom plugin as suggested in #15179 (comment)

@sigtm
Copy link

sigtm commented Jul 28, 2020

@tsteur Yeah we have that plugin on our end, but the Live counter still "forgets" about visitors who are on a page but not triggering any requests. Our use case centers around video streaming, so people are often on a page for a long time without triggering anything.

So onExistingVisit should fire regularly even with the new "heartbeat-less" heartbeat logic? If so I will just dig around a bit more on our end and see if I can figure out.

@sigtm
Copy link

sigtm commented Jul 28, 2020

@tsteur For what it's worth, sending ping requests explicitly fixes our Live counter numbers.

Our version of that plugin does have a $request->getParam('ping') == 1 check – not sure if that affects the heartbeat feature? I would assume onExistingVisit simply doesn't fire every 15 seconds like it used to, since the heartbeat no longer triggers pings. But I haven't been able to test that theory, since the back-end is way outside my area of expertise.

@tsteur
Copy link
Member

tsteur commented Jul 28, 2020

BTW if you are having a lot of video then Media Analytics should do the trick for you.

If the problem is otherwise that the ping is not triggered, then something like this might help:

setInterval(function () {.
window._paq = window._paq || [];
window._paq.push(['ping'])
  }, 15000);

@sigtm
Copy link

sigtm commented Jul 29, 2020

Our use case is extra niche since our technology is usually integrated into a player that we don't control  – we are essentially tracking an isolated web view, not the player/media itself.

But there are some cases where we do provide the player as well, so thanks for the tip. I will check that plugin out!

And yeah that snippet is essentially what I ended up doing 👍 Might be worth updating the part about enableHeartBeatTimer here?

https://developer.matomo.org/api-reference/tracking-javascript

Since it is no longer accurate to say that it "regularly sends requests", which changes the Live.getCounter results if you are using the reporting API.

@tsteur
Copy link
Member

tsteur commented Jul 29, 2020

Thanks @sigtm removed the "regular"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Documentation For issues related to in-app product help messages, or to the Matomo knowledge base.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants