analytics: change munchkin script

This commit is contained in:
Ben Spoon 2016-08-16 11:41:01 -07:00
parent a706901405
commit c91295da95

View file

@ -66,9 +66,27 @@
{% if munchkin_key %}
<script type="text/javascript">
document.write(unescape("%3Cscript src='//munchkin.marketo.net/munchkin.js' type='text/javascript'%3E%3C/script%3E"));
(function() {
var didInit = false;
function initMunchkin() {
if(didInit === false) {
didInit = true;
Munchkin.init('{{ munchkin_key }}');
}
}
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//munchkin.marketo.net/munchkin-beta.js';
s.onreadystatechange = function() {
if (this.readyState == 'complete' || this.readyState == 'loaded') {
initMunchkin();
}
};
s.onload = initMunchkin;
document.getElementsByTagName('head')[0].appendChild(s);
})();
</script>
<script>Munchkin.init('{{ munchkin_key }}');</script>
{% endif %}
{% if google_analytics_key %}