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

Set up Google Analytics 4 (GA4) #3620

Closed
5 tasks done
Tracked by #166
chalin opened this issue Nov 8, 2023 · 4 comments · Fixed by #3627
Closed
5 tasks done
Tracked by #166

Set up Google Analytics 4 (GA4) #3620

chalin opened this issue Nov 8, 2023 · 4 comments · Fixed by #3627

Comments

@chalin
Copy link
Contributor

chalin commented Nov 8, 2023

Hi all, I've been asked to help in setting up GA4; @zijianjoy wrote cncf/sandbox#196:

Sounds good, @nate-double-u Please feel free to comment here for how to move forward integrating with CNCF analytics account. The kubeflow website is located in https://github.com/kubeflow/website

I lead the earlier CNCF effort to upgrade project websites to GA4, so @nate-double-u has asked me to help (he's at KubeCon). I can follow a similar process for Kubeflow if you'd like. I'll outline the steps here.

Tasks

  • Create a GA4 site tag under the CNCF projects account.
    New GA4 stream measurement ID: G-Y2KDEK0998
  • Configure the website to use the new site tag. We have two options here:
    • (Option A) Configure GA4 site tag through Docsy config -
      Use the new CNCF GA4 site tag in Hugo config #3627
    • (Option B) Configure GA4 website ID (gtag.js) through Netlify snippet injection, "Google Analytics 4 - only in production", just before </head>:
      {% if CONTEXT == 'production' %}
      <!-- Google tag (gtag.js) -->
      <script async src="https://www.googletagmanager.com/gtag/js?id=G-Y2KDEK0998"></script>
      <script>
        window.dataLayer = window.dataLayer || [];
        function gtag(){dataLayer.push(arguments);}
        gtag('js', new Date());
      
        gtag('config', 'G-Y2KDEK0998');
      </script>
      {% endif %}
  • Confirm that the GA4 site tag is receiving events
  • Cleanup: drop config using the old UA ID:

    website/config.toml

    Lines 81 to 83 in 746e719

    [services]
    [services.googleAnalytics]
    id = "UA-135379910-1"

    Use the new CNCF GA4 site tag in Hugo config #3627

Pre-migration analytics info for the website

  • UA ID UA-135379910-1 is registered using gtag.js
  • Hosted on Netlify

Followup

References

Onboarding tracker issue:

I know that there existed an issue for the migration already, but given that UA properties aren't functional anymore, this is "Set up" more than a migration:

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

@thesuperzapper
Copy link
Member

@chalin do we also want to migrate the google search console ownership?

Which is currently done via this file: https://github.com/kubeflow/website/blob/master/static/google65401334ad4c38b1.html

@zijianjoy
Copy link
Contributor

Thank you @chalin for working on this item! I have approved your PR and feel free to comment here if we need any action to complete the task. (Validation, cleanup, etc.)

@chalin
Copy link
Contributor Author

chalin commented Nov 27, 2023

Hi, I'm back at the office, and slowly catching up. I'm glad to see GA4 setup!
I'll come back here to respond to questions when I next have the time.

@chalin
Copy link
Contributor Author

chalin commented Nov 29, 2023

@chalin do we also want to migrate the google search console ownership?

Which is currently done via this file: https://github.com/kubeflow/website/blob/master/static/google65401334ad4c38b1.html

@thesuperzapper - moving this thread to:

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

Successfully merging a pull request may close this issue.

3 participants