added piwik tracking for: ajax loading timing, site search
This commit is contained in:
@@ -11,6 +11,10 @@
|
||||
var _audioPlayer;
|
||||
var _randomPlayer;
|
||||
var _compoPlayer;
|
||||
var _ajax_timing = {
|
||||
start:0,
|
||||
end:0
|
||||
};
|
||||
|
||||
// ___ _ _
|
||||
// |_ _|_ _ (_) |_
|
||||
@@ -163,7 +167,7 @@
|
||||
function ajaxLoadContent(state){
|
||||
console.log('ajaxLoadContent : state', state);
|
||||
_$body.addClass('ajax-loading');
|
||||
|
||||
_ajax_timing.start = performance.now();
|
||||
var path = window.location.origin + Drupal.url(state.ajax_path);
|
||||
$.getJSON(path, {})
|
||||
.done(function(data){
|
||||
@@ -318,7 +322,12 @@
|
||||
// https://matomo.org/blog/2017/02/how-to-track-single-page-websites-using-piwik-analytics/
|
||||
_paq.push(['setCustomUrl', state.url]);
|
||||
_paq.push(['setDocumentTitle', data.title]);
|
||||
// TODO: piwik track load time
|
||||
_ajax_timing.end = performance.now();
|
||||
_paq.push(['setGenerationTimeMs', _ajax_timing.end-_ajax_timing.start]);
|
||||
_paq.push(['trackPageView']);
|
||||
|
||||
|
||||
// js event
|
||||
// trackEvent(category, action, [name], [value])
|
||||
_paq.push(['trackEvent', 'AjaxNav', 'loaded', state.url]);
|
||||
|
||||
Reference in New Issue
Block a user