Skip to content

Google analytics is enabled for site previews #133

Description

@chalin

Google analytics should be enabled for the production server only. It's current active for site previews as well.

For example, see the page source for the homepage of this preview, https://deploy-preview-130--containerd-io.netlify.app:

<!DOCTYPE html>
<html lang="en-us">
  <head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-71407002-1', 'auto');
ga('send', 'pageview');
</script>
    ...
  <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-117325385-1"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-117325385-1');
</script></head>

  <body class="page is-home-page has-navbar-fixed-top">
  </body>
</html>

Related:

/cc @nate-double-u

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions