{% if GOOGLE_ANALYTICS_KEY %}
  <!-- Google tag (gtag.js) -->
  <script async src="https://www.googletagmanager.com/gtag/js?id={{ GOOGLE_ANALYTICS_KEY }}"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());

    gtag('config', '{{ GOOGLE_ANALYTICS_KEY }}'{% if user.id %}, {'user_id': {{ user.id }}}{% endif %});
  </script>
{% endif %}
