Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Google Analytics 4 (GA4) #245

Closed
4 tasks done
chalin opened this issue Nov 4, 2022 · 2 comments
Closed
4 tasks done

Migrate to Google Analytics 4 (GA4) #245

chalin opened this issue Nov 4, 2022 · 2 comments

Comments

@chalin
Copy link

chalin commented Nov 4, 2022

This is part of a CNCF-wide effort to upgrade project websites to GA4 since Google has deprecated Universal Analytics (UA). For more details, see:

Tasks (stages 1, 2 & 3):

  • From the Prometheus websites data stream (G-80ZM8LGB96), configure cross-domain measurement to promcon.io.
  • Configure GA4 ID through Netlify snippet injection, "Google Analytics 4 - only in production", just before </head>:
    {% if CONTEXT == 'production' %}
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-80ZM8LGB96"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-80ZM8LGB96');
    </script>
    {% endif %}
  • Confirm that the GA4 site tag is receiving events
  • Confirm that the UA site tag, UA-58468480-3, is still receiving events

Notes

/cc @nate-double-u @caniszczyk @juliusv


Current website analytics info:

  • UA site tag: UA-58468480-3

Hugo layout relevant for the main tag:

  • <!-- Google Analytics -->
    <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','//www.google-analytics.com/analytics.js','ga');
    ga('create', 'UA-58468480-3', 'auto');
    ga('send', 'pageview');
    </script>
@chalin
Copy link
Author

chalin commented Nov 4, 2022

@juliusv - I've setup GA4 via Netlify snippet injection, while keeping the UA site tag as it is currently -- so no code changes were necessary.

All that will be left to do later is to drop the UA-specific code from the website (#246), once you've decided that you don't want to use that property anymore, or it stops receiving data (in 2023).

Closing the issue since all is done for now.

@chalin chalin closed this as completed Nov 4, 2022
@juliusv
Copy link
Contributor

juliusv commented Nov 4, 2022

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants