hypothesis / h

Annotate with anyone, anywhere.
https://hypothes.is/
BSD 2-Clause "Simplified" License
2.96k stars 427 forks source link

Change "Google Tag Manager container ID" to "Google Analytics measurement ID" #9014

Closed robertknight closed 1 month ago

robertknight commented 1 month ago

In 553a875104fbeba607da2cc071549a687321656b there was a misunderstanding about the change being made. We're not using Google Tag Manager, which is a tool that allows adding tags to pages without editing their code. Instead we're still injecting a tag ID as part of the h code, but using gtag.js instead of the deprecated analytics.js.

The type of ID we're injecting is called a "Google Analytics measurement ID" in the Google Analytics UI and documentation, as described at https://support.google.com/analytics/answer/12270356.

See also https://support.google.com/analytics/answer/10271001 (this page uses the term "property ID" instead of "measurement ID")

Testing:

  1. Set the environment variable GOOGLE_ANALYTICS_MEASUREMENT_ID before starting h, to eg. G-1234
  2. Start h dev server
  3. Go to page in h, eg. http://localhost:5000/docs/help. There should be a network request to https://www.googletagmanager.com/gtag/js?id=G-1234