Skip to content
Snippets Groups Projects
Commit c7f33097 authored by Arthur Suzuki's avatar Arthur Suzuki
Browse files

better facets recognition

drop support for deprecated "customVar" function
parent 0d91dd60
Branches
No related merge requests found
......@@ -6,34 +6,31 @@ var tracksearch = false;
var search_keywords = decodeURI(document.URL.match('expressionRecherche/([^/]+)')[1]);
var search_type = document.URL.match('recherche/([^/]+)')[1];
var search_facets = '';
//var search_motif = true;
var search_page = '';
var result_count = 0;
// compatibilité Magasin de thème
if ( $('body').attr('data-template') && $('div.search_result') ) {
var result_count = $('li.result_count_results').text().match('[0-9]+')[0];
search_facets = $('div.criteres_recherche a.active_criteria:visible div').text();
result_count = $('li.result_count_results').text().match('[0-9]+')[0];
search_page = $('li.result_pager span').html().match(' ([0-9]+) /')[1];
tracksearch = true;
}
// compatibilité thème historique
if ( $('body').hasClass('template_HISTORIC') && $('div.resultats_page')) {
var result_count = $('span.nombre-recherche').text().match('[0-9]+')[0];
search_facets = $('div.criteres_recherche').text();
result_count = $('span.nombre-recherche').text().match('[0-9]+')[0];
search_page = $('div.pager span.current a').html();
tracksearch = true;
}
if (tracksearch) {
_paq.push(['setCustomVariable', 1,'nombre de résultat' , result_count, 'page']);
_paq.push(['setCustomVariable', 2, 'type de recherche', search_type, 'page']);
//same as facets _paq.push(['setCustomVariable', 3, 'motif de recherche', search_motif, 'page']);
_paq.push(['setCustomVariable', 4, 'facette de recherche', search_facets, 'page']);
_paq.push(['setCustomVariable', 5, 'page', results_page, 'page']);
$('div.criteres_recherche a[href*="multifacets"][title*="Retirer"]').toArray().forEach(e => search_facets += $(e).text() + "; ")
_paq.push(['trackSiteSearch', search_keywords, search_facets, result_count]);
}
else { _paq.push(['trackPageView']); }
else {
_paq.push(['trackPageView']);
}
_paq.push(['enableLinkTracking']);
(function() {
var u=(("https:" == document.location.protocol) ? "https" : "http") + "://matomo.biblibre.com/";
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment