Navigation Menu

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

How do HeartBeatTimer work? #11808

Closed
larsnystrom opened this issue Jun 20, 2017 · 2 comments
Closed

How do HeartBeatTimer work? #11808

larsnystrom opened this issue Jun 20, 2017 · 2 comments
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@larsnystrom
Copy link

larsnystrom commented Jun 20, 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(['trackPageView']);
            _paq.push(['enableHeartBeatTimer', 10]);
            _paq.push(['enableLinkTracking']);
            (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);
            })();
    </script>

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.

@larsnystrom larsnystrom changed the title HeartBeatTimer does not work How do HeartBeatTimer work? Jun 20, 2017
@tsteur
Copy link
Member

tsteur commented Jun 21, 2017

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

larsnystrom added a commit to larsnystrom/developer-documentation that referenced this issue Jun 22, 2017
@larsnystrom
Copy link
Author

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.

mattab pushed a commit to matomo-org/developer-documentation that referenced this issue Jun 22, 2017
#185)

* Note concerning testing of heartbeattimer, see matomo-org/matomo#11808

* Update tracking-javascript-guide.md
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

No branches or pull requests

3 participants