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 to track Single Page Applications? #7998

Closed
stefan-niedermann opened this issue May 26, 2015 · 9 comments
Closed

How to track Single Page Applications? #7998

stefan-niedermann opened this issue May 26, 2015 · 9 comments
Labels
c: Website matomo.org For issues related to our matomo.org website. duplicate For issues that already existed in our issue tracker and were reported previously.

Comments

@stefan-niedermann
Copy link

As a User i want to be able to track my Single Page Application.
It uses a URL hash as "Page Identifier", like "xyz.com/#links", "xyz.com/#welcome" and so on.

@quba
Copy link
Contributor

quba commented May 26, 2015

Enable "Page URL fragments tracking" in Websites settings and manually trigger trackPageView after each site "refresh".

@stefan-niedermann
Copy link
Author

thanks

@quba quba added the answered For when a question was asked and we referred to forum or answered it. label May 26, 2015
@mattab
Copy link
Member

mattab commented Feb 23, 2016

I am re-opening this issue, as there is a strong need for us to document the best practise around "Measuring Single Page Applications". Let's create a User Guide or at least FAQ with our set of best practises.

@mattab mattab reopened this Feb 23, 2016
@mattab mattab added this to the 2.16.x milestone Feb 23, 2016
@mattab mattab added c: Website matomo.org For issues related to our matomo.org website. and removed answered For when a question was asked and we referred to forum or answered it. labels Feb 23, 2016
@mattab
Copy link
Member

mattab commented Feb 23, 2016

Maybe there is also potential to build a better tracking API, or build in piwik.js some useful features, to make tracking single page app better & easier.

For example last week Google released a new tool which helps users measure their single page app:

URL change tracking for single page applications
If you're building a single page application that dynamically loads content and updates the URL using the History API, the default tracking snippet will not suffice -- it only tracks the initial page load. Even if you're sending additional pageviews after successfully loading new content, there can still be complications.
Autotrack automatically detects URL changes made via the History API and tracks those as pageviews. It also keeps the tracker in sync with the updated URL so all subsequent hits (events, social interactions, etc.) are associated with the correct URL.

(this issue is about creating a FAQ. If we identify potential to also create a new feature in piwik.js we shall create a separate issue)

@mattab
Copy link
Member

mattab commented Aug 15, 2016

This issue is tracked in: matomo-org/developer-documentation#90 (comment)

If anyone has measured their single page app with Piwik, please let us know any tip or advice in the comments on matomo-org/developer-documentation#90 - we'd like to write this guide in the future 👍

@mattab mattab closed this as completed Aug 15, 2016
@mattab mattab added the duplicate For issues that already existed in our issue tracker and were reported previously. label Aug 15, 2016
@mattab
Copy link
Member

mattab commented Feb 21, 2017

We've just published the guide, check it out here: How to track single-page websites and web applications using Piwik Analytics

@mattab
Copy link
Member

mattab commented Feb 21, 2017

and FAQ: How do I measure my single-page websites and apps with Piwik?

@pappaschris
Copy link

We've just published the guide, check it out here: How to track single-page websites and web applications using Piwik Analytics

The guide covers navigation through location hash changes but History API navigation is not mentioned at all. Is there a best practice recommendation for this case?

@tsteur
Copy link
Member

tsteur commented Feb 14, 2019

You can listen to window.onpopstate = function(event) {}; instead and make changes depending on your application. It's otherwise pretty much the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Website matomo.org For issues related to our matomo.org website. duplicate For issues that already existed in our issue tracker and were reported previously.
Projects
None yet
Development

No branches or pull requests

5 participants