What Grafana version and what operating system are you using?
Grafana OS 11.2.3 in Docker Engine on Ubuntu 20.04
What are you trying to achieve?
Tracking usage of Grafana by using a Google Analytics 4 tracking code
How are you trying to achieve it?
Tried two ways:
-
Setting an environment variable when running the docker container
-e “GF_ANALYTICS_GOOGLE_ANALYTICS_4_ID=G-xxxxxxxxxx” -
Setting the google_analytics_4_id configuration option in grafana.ini
No other settings were enabled/changed.
What happened?
The tracking code does not get injected in any Grafana page, hence, Google Analytics does not receive any input from the site.
What did you expect to happen?
I expected the tracking code to be injected so it gets called every time a page is visited.
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No errors/warning related to this on the log. The only info entry appears when the Google Measurement ID is added both in the grafana.ini file and as specified as an environment variable, reporting that the environment variable overwrote the setting in grafana.ini:
logger=settings t=2024-10-22T16:50:55.16517003Z level=info msg="Config overridden from Environment variable" var="GF_ANALYTICS_GOOGLE_ANALYTICS_4_ID=G-XXXXXXXXXX"
Did you follow any online instructions? If so, what is the URL?
Any help is appreciated.