diff --git a/_includes/google-analytics.html b/_includes/google-analytics.html index 392024d..503058b 100644 --- a/_includes/google-analytics.html +++ b/_includes/google-analytics.html @@ -1,30 +1,28 @@ {% if jekyll.environment == "production" %} - {% assign gid = site.env.NETLIFY_GOOGLE_ANALYTICS_ID %} - {{ gid }} +{% assign gid = site.env.NETLIFY_GOOGLE_ANALYTICS_ID %} +{% if gid %} + + - +{% else %} +{% if site.google_analytics_id %} + + - {% else %} - {% if site.google_analytics_id %} - - - {% endif %} - {% endif %} + function gtag() { + dataLayer.push(arguments); + } + gtag('js', new Date()); + gtag('config', '{{ site.google_analytics_id }}'); + +{% endif %} +{% endif %} {% endif %} \ No newline at end of file