mirror of
https://github.com/funkypenguin/geek-cookbook/
synced 2025-12-13 01:36:23 +00:00
Setup preview branch (#88)
* Setup preview branch * Add rightmessage js * Actually calling the js will help * Fussy javascript * Test embedded message after recipe * Update main.html
This commit is contained in:
@@ -25,3 +25,49 @@
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block analytics %}
|
||||
<!-- RightMessage -->
|
||||
<script type="text/javascript">
|
||||
(function(p, a, n, d, o, b, c) {
|
||||
o = n.createElement('script'); o.type = 'text/javascript'; o.async = true; o.src = 'https://tb.rightmessage.com/'+p+'.js';
|
||||
b = n.getElementsByTagName('script')[0]; d = function(h, u, i) { var c = n.createElement('style'); c.id = 'rmcloak'+i;
|
||||
c.type = 'text/css'; c.appendChild(n.createTextNode('.rmcloak'+h+'{visibility:hidden}.rmcloak'+u+'{display:none}'));
|
||||
b.parentNode.insertBefore(c, b); return c; }; c = d('', '-hidden', ''); d('-stay-invisible', '-stay-hidden', '-stay');
|
||||
setTimeout(o.onerror = function() { c.parentNode && c.parentNode.removeChild(c); }, a); b.parentNode.insertBefore(o, b);
|
||||
})('1802694484', 20000, document);
|
||||
</script>
|
||||
{% set analytics = config.google_analytics %}
|
||||
<link rel="preconnect dns-prefetch" href="https://www.google-analytics.com">
|
||||
|
||||
<script type="application/javascript">
|
||||
window.ga = window.ga || function() {
|
||||
(ga.q = ga.q || []).push(arguments)
|
||||
}
|
||||
ga.l = +new Date
|
||||
|
||||
/* Set up 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", function() {
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
/* Send page view on document switch (instant loading, custom event) */
|
||||
document.addEventListener("DOMContentSwitch", function() {
|
||||
ga("send", "pageview")
|
||||
})
|
||||
</script>
|
||||
<script async src="https://www.google-analytics.com/analytics.js"></script>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user