fix(core): update
This commit is contained in:
24
material/partials/integrations/analytics.html
Normal file
24
material/partials/integrations/analytics.html
Normal file
@ -0,0 +1,24 @@
|
||||
{% set analytics = config.google_analytics %}
|
||||
<script>
|
||||
window.ga = window.ga || function() {
|
||||
(ga.q = ga.q || []).push(arguments)
|
||||
}
|
||||
ga.l = +new Date
|
||||
/* Setup integration and send page view */
|
||||
ga("create", "{{ analytics[0] }}", "{{ analytics[1] }}")
|
||||
ga("set", "anonymizeIp", true)
|
||||
ga("send", "pageview")
|
||||
/* Register handler to log search on blur */
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (document.forms.search) {
|
||||
var query = document.forms.search.query
|
||||
query.addEventListener("blur", function() {
|
||||
if (this.value) {
|
||||
var path = document.location.pathname;
|
||||
ga("send", "pageview", path + "?q=" + this.value)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<script async src="https://www.google-analytics.com/analytics.js"></script>
|
Reference in New Issue
Block a user