2019-06-15 16:16:14 +03:00
|
|
|
{% set analytics = config.google_analytics %}
|
|
|
|
<script>
|
|
|
|
window.ga = window.ga || function() {
|
2019-02-12 20:11:40 +03:00
|
|
|
(ga.q = ga.q || []).push(arguments)
|
|
|
|
}
|
|
|
|
ga.l = +new Date
|
2019-02-09 19:54:08 +03:00
|
|
|
/* Setup integration and send page view */
|
2019-02-12 20:11:40 +03:00
|
|
|
ga("create", "{{ analytics[0] }}", "{{ analytics[1] }}")
|
|
|
|
ga("set", "anonymizeIp", true)
|
|
|
|
ga("send", "pageview")
|
2019-02-09 19:54:08 +03:00
|
|
|
/* Register handler to log search on blur */
|
|
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
|
|
if (document.forms.search) {
|
2019-02-12 20:11:40 +03:00
|
|
|
var query = document.forms.search.query
|
2019-02-09 19:54:08 +03:00
|
|
|
query.addEventListener("blur", function() {
|
|
|
|
if (this.value) {
|
|
|
|
var path = document.location.pathname;
|
2019-02-12 20:11:40 +03:00
|
|
|
ga("send", "pageview", path + "?q=" + this.value)
|
2019-02-09 19:54:08 +03:00
|
|
|
}
|
2019-02-12 20:11:40 +03:00
|
|
|
})
|
2019-02-09 19:54:08 +03:00
|
|
|
}
|
2019-06-15 16:16:14 +03:00
|
|
|
})
|
|
|
|
</script>
|
|
|
|
<script async src="https://www.google-analytics.com/analytics.js"></script>
|