toodego: keep (anonymised) track of search terms (#33889)

This commit is contained in:
Frédéric Péters 2020-06-30 17:24:00 +02:00
parent a507c05e1c
commit af34c56c23
3 changed files with 18 additions and 2 deletions

View File

@ -897,7 +897,8 @@ body.focus-in #page.search-page {
}
div#cell-filter {
border: none;
> div {
form {
width: 100%;
display: flex;
input {
flex: 1;

View File

@ -381,6 +381,7 @@ $(function() {
$('#mapsearch').on('submit', function() {
// live search but we trigger the change event to be sure
$map_search_input.trigger('change');
track_search($map_search_input.val());
return false;
});
$(map).on('movestart', function() {
@ -973,6 +974,12 @@ $(function() {
$('#columns > .group-title').show();
}
});
$('#cell-filter form').on('submit', function() {
// live search but we trigger nevertheless
$(this).find('input[type=search]').trigger('change');
track_search($(this).find('input[type=search]').val());
return false;
});
$(document).on('combo:cell-loaded', function(ev, elem) {
/* "your profile" cell */
@ -1112,4 +1119,11 @@ $(function() {
}
});
function track_search(q) {
// keep (anonymised) track of search terms used in internal search fields.
if (typeof _paq !== 'undefined') {
_paq.push(['trackSiteSearch', q]);
}
}
});

View File

@ -1,3 +1,4 @@
<form id="service-filter">
<input type="search" placeholder="{% spaceless %}{{cell.text|striptags}}{% endspaceless %}" name="q">
<button class="icon-search"><span class="sr-only">Chercher</span></button>
</form>