2019-08-02 08:57:41 +02:00
|
|
|
{% if jekyll.environment == "production" %}
|
|
|
|
{% if site.google_analytics_key %}
|
|
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics_key }}"></script>
|
|
|
|
<script type="text/javascript">
|
2017-04-22 23:41:03 +02:00
|
|
|
|
2019-08-02 08:57:41 +02:00
|
|
|
var _gaq = _gaq || [];
|
|
|
|
_gaq.push(['_setAccount', '{{ site.google_analytics_key }}']);
|
|
|
|
_gaq.push(['_trackPageview']);
|
2017-04-22 23:41:03 +02:00
|
|
|
|
2019-08-02 08:57:41 +02:00
|
|
|
(function() {
|
|
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
|
|
})();
|
2017-04-22 23:41:03 +02:00
|
|
|
|
2019-07-27 15:42:45 +02:00
|
|
|
|
2019-08-02 08:57:41 +02:00
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
|
gtag('js', new Date());
|
|
|
|
gtag('config', '{{ site.google_analytics_key }}');
|
|
|
|
</script>
|
|
|
|
{% endif %}
|
|
|
|
{% else %}
|
|
|
|
<script>
|
|
|
|
function gtag() { console.log('noop'); }
|
2017-04-22 23:41:03 +02:00
|
|
|
</script>
|
|
|
|
{% endif %}
|