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

Enable Google Analytics 4 (GA4) #2680

Closed
2 tasks done
chalin opened this issue Nov 16, 2022 · 13 comments · Fixed by #2681 or #2708
Closed
2 tasks done

Enable Google Analytics 4 (GA4) #2680

chalin opened this issue Nov 16, 2022 · 13 comments · Fixed by #2681 or #2708
Assignees

Comments

@chalin
Copy link

chalin commented Nov 16, 2022

As discussed elsewhere (https://cncfservicedesk.atlassian.net/browse/CNCFSD-1458), the plan is to enable GA4 by using the existing GA4 Envoy web data stream with ID G-DXJEH1ZRXX.

For some context, the main repo was migrated to GA4 via:

Let's use this issue to discuss implementation details.

Tasks:

@chalin
Copy link
Author

chalin commented Nov 16, 2022

From @jpsim:

The Envoy Mobile website is hosted by GitHub Pages here: GitHub - envoy-mobile/envoy-mobile.github.io: Envoy Proxy website

The site is auto-generated using Sphinx whenever there are changes to the Envoy Mobile repo: envoy-mobile/docs at main · envoyproxy/envoy-mobile

I was able to hook up Google Analytics in Sphinx using this extension: GitHub - sphinx-contrib/googleanalytics

However, it seems to expect a GA tag with the format UA-123-123-123, will that work with the G-DXJEH1ZRXX tag that you shared earlier?

I'm not familiar with that extension so I don't know if it supports GA4. We can give it a try :).

@jpsim
Copy link
Contributor

jpsim commented Nov 16, 2022

Giving it a try here: #2681

@chalin
Copy link
Author

chalin commented Nov 16, 2022

I'm not seeing any GA4 ID in the site pages, are you @jpsim? If not, can you re-open this issue :)?

@chalin
Copy link
Author

chalin commented Nov 16, 2022

Oh ... now that I've caught up with your comment in the Jira ticket, I see that what you've done is enabled GA over the doc pages. I was looking at the main site. Can you reopen this issue so that we can use it to track the addition of GA to the main site too?

@jpsim jpsim reopened this Nov 16, 2022
@jpsim
Copy link
Contributor

jpsim commented Nov 16, 2022

Since you have access to the analytics dashboard, can you check if you see traffic from the EM docs site which was deployed about an hour ago? Like on this page? https://envoymobile.io/docs/envoy-mobile/latest/index.html

@chalin
Copy link
Author

chalin commented Nov 16, 2022

AFAIK, the GA4 console doesn't, at the moment, have as good realtime traffic data as UA does, so I can't tell if there's traffic from the EM docs site yet. Usually, I test pages in true realtime using the Google Tag Assistant, but it is refusing to connect to the site, apparently because the homepage doesn't have a GA ID.

@jpsim - can you add the GA4 ID to all of the main (non-docs) site pages? Then I'll be able to use the tag assistant.

@jpsim
Copy link
Contributor

jpsim commented Nov 17, 2022

Ok @chalin, I just updated the only other non-doc page in envoy-mobile/envoy-mobile.github.io#27

@jpsim
Copy link
Contributor

jpsim commented Nov 17, 2022

Seems to be hooked up correctly on the website side of things. Here's the network activity when loading https://envoymobile.io before and after envoy-mobile/envoy-mobile.github.io#27:

Before

before

After

after

@chalin
Copy link
Author

chalin commented Nov 18, 2022

From the analytics console I'm seeing traffic only from the landing page:

image

Your "after" network screenshot above confirms that the sphinxcontrib.googleanalytics plugin uses the old analytics.js library. GA4 requires the gtag.js library. Maybe you can propose an update to the plugin? (For details see, Migrate from analytics.js to gtag.js (Universal Analytics).)

@chalin
Copy link
Author

chalin commented Nov 18, 2022

I see that the sphinxcontrib.googleanalytics plugin was updated to support gtag.js in August: https://github.com/sphinx-contrib/googleanalytics/blob/42b3df99fdc01a136b9c575f3f251ae80cdfbe1d/sphinxcontrib/googleanalytics.py#L13

So maybe it's a question of fetching the latest version?

@chalin
Copy link
Author

chalin commented Nov 18, 2022

Here is what I used on another project:

sphinxcontrib-googleanalytics @ git+https://github.com/sphinx-contrib/googleanalytics.git@42b3df99fdc01a136b9c575f3f251ae80cdfbe1d

@jpsim
Copy link
Contributor

jpsim commented Nov 28, 2022

We require tagged releases for our Python dependencies. Here's what I get when I point to the latest commit:

ERROR: Can't verify hashes for these requirements because we don't have a way to hash version control repositories:
    sphinxcontrib-googleanalytics@ git+https://github.com/sphinx-contrib/googleanalytics.git@42b3df99fdc01a136b9c575f3f251ae80cdfbe1d from git+https://github.com/sphinx-contrib/googleanalytics.git@42b3df99fdc01a136b9c575f3f251ae80cdfbe1d (from -r ./docs/requirements.txt (line 105))

I've requested a tagged release in sphinx-contrib/googleanalytics#5

@jpsim
Copy link
Contributor

jpsim commented Nov 29, 2022

Updating in #2708

arkodg added a commit to arkodg/gateway that referenced this issue Dec 13, 2024
* Use the same as the envoy proxy and envoy mobile websites

Relates to envoyproxy/envoy-website#273 & envoyproxy/envoy-mobile#2680

Signed-off-by: Arko Dasgupta <[email protected]>
arkodg added a commit to arkodg/gateway that referenced this issue Dec 13, 2024
* Use the same as the envoy proxy and envoy mobile websites

Relates to envoyproxy/envoy-website#273 & envoyproxy/envoy-mobile#2680

Signed-off-by: Arko Dasgupta <[email protected]>
arkodg added a commit to envoyproxy/gateway that referenced this issue Dec 16, 2024
* Use the same as the envoy proxy and envoy mobile websites

Relates to envoyproxy/envoy-website#273 & envoyproxy/envoy-mobile#2680

Signed-off-by: Arko Dasgupta <[email protected]>
Dean-Coakley pushed a commit to Dean-Coakley/envoy-gateway that referenced this issue Dec 20, 2024
* Use the same as the envoy proxy and envoy mobile websites

Relates to envoyproxy/envoy-website#273 & envoyproxy/envoy-mobile#2680

Signed-off-by: Arko Dasgupta <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants