Skip to content

Commit

Permalink
[docs] Fix GA javascript. (cloudprober#331)
Browse files Browse the repository at this point in the history
manugarg authored Apr 12, 2023
1 parent 26a416e commit 1f8d571
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions docs/layouts/partials/head/custom-head.html
Original file line number Diff line number Diff line change
@@ -50,10 +50,12 @@
});
/* Register handler to log search on blur */
var query = document.querySelector('.query');
query.addEventListener('blur', function () {
if (this.value) {
var path = document.location.pathname;
ga('send', 'pageview', path + '?q=' + this.value);
}
});
if (query) {
query.addEventListener('blur', function () {
if (this.value) {
var path = document.location.pathname;
ga('send', 'pageview', path + '?q=' + this.value);
}
});
}
</script>

0 comments on commit 1f8d571

Please sign in to comment.