@larsnystrom opened this Issue on June 20th 2017

Maybe I'm just missing something obvious, but in that case I hope this ticket can lead to a documentation fix.

I'm trying to enable heart beat timer. Here's the script I've added to the top of my page:

    <script type="text/javascript">
            var _paq = _paq || [];
            /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
            _paq.push(['enableHeartBeatTimer', 10]);
            (function() {
                    var u=<?= json_encode($this->piwikUrl) ?>;
                    _paq.push(['setTrackerUrl', u+'piwik.php']);
                    _paq.push(['setSiteId', '1']);
                    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
                    g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);

I was under the impression that the heart beat timer would send an xhr request every 10 seconds, but after opening the page and keeping it open for >30 seconds no additional requests have been made, besides the normal page tracking request.

Is this a bug, a misconfiguration or a misunderstanding? I'm using Piwik 3.0.4.

@tsteur commented on June 21st 2017 Member

Maybe the browser window doesn't have focus. Make sure the browser tab has focus and not eg dev tools.

@larsnystrom commented on June 22nd 2017

Ah, that was it! Thank you! Could we possibly add a note of some sort to the documentation, like:

Note: When testing the heart beat timer, remember to make sure the browser tab has focus and not e.g. dev tools.

Of course, one could infer this from the current documentation, but I think explicitly mentioning dev tools could help others like me. I'll create a PR. You can reject it if you just think I'm stupid.

This Issue was closed on June 23rd 2017
Powered by GitHub Issue Mirror