update ga

pull/1/head
Robert Austin 2019-03-13 17:46:17 +10:00
parent 4f35c2e653
commit 593d6e5fba
1 changed files with 24 additions and 26 deletions

View File

@ -1,10 +1,8 @@
{% if jekyll.environment == "production" %}
{% assign gid = site.env.NETLIFY_GOOGLE_ANALYTICS_ID %}
{{ gid }}
{% if gid %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ gid }}"></script>
<script>
{% assign gid = site.env.NETLIFY_GOOGLE_ANALYTICS_ID %}
{% if gid %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ gid }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
@ -12,11 +10,11 @@
}
gtag('js', new Date());
gtag('config', '{{ $gid }}');
</script>
{% else %}
{% if site.google_analytics_id %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics_id }}"></script>
<script>
</script>
{% else %}
{% if site.google_analytics_id %}
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google_analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
@ -24,7 +22,7 @@
}
gtag('js', new Date());
gtag('config', '{{ site.google_analytics_id }}');
</script>
{% endif %}
{% endif %}
</script>
{% endif %}
{% endif %}
{% endif %}