@wei1215583760 opened this Issue on August 18th 2017

I have read this blog to track single-page website, but i do not know how to use setGenerationTimeMs() to track new page view generation time with different url and where these code should it be placed in the index.html? Should it be located before piwik traditional tracking code ?
@Sija @nbezzala
if you can reply, i will be grateful your for help

0b1fa1c386f3b04b97c4439fff75f333

https://piwik.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/

@sgiehl commented on August 18th 2017 Member

@wei1215583760 would you mind asking your questions in our forum: https://forum.piwik.org
This is an issue tracker and should be used for reporting bugs or suggesting new features, not for asking questions.

@wei1215583760 commented on August 18th 2017

Piwik also supplies method to solve this problem as follows:
https://piwik.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/

But I just do not know where to place these code
var currentUrl = location.href;
window.addEventListener('hashchange', function() {
_paq.push(['setReferrerUrl', currentUrl]);
currentUrl = '' + window.location.hash.substr(1);
_paq.push(['setCustomUrl', currentUrl]);
_paq.push(['setDocumentTitle', 'My New Title']);

// remove all previously assigned custom variables, requires Piwik 3.0.2
_paq.push(['deleteCustomVariables', 'page']); 
_paq.push(['setGenerationTimeMs', 0]);
_paq.push(['trackPageView']);

});

and how to measure generation time with different url of single-page website

@sgiehl commented on September 10th 2017 Member

It depends on your usage of AngularJS and how pages are loaded. I would include that JS right after the JS that loads new page content. The generation time needs to be calculated by your JS and needs to be set for _paq.push(['setGenerationTimeMs', 0]);

But as mentioned: Please ask further questions in our forum or get in touch with professional support.

This Issue was closed on September 10th 2017
Powered by GitHub Issue Mirror