By default, MyST sites contain no tracking cookies or analytics. However, we offer support for two analytics tracking systems:
Google Analytics; and
Plausible, which is privacy-friendly alternative to Google.
These are set using template specific options in your site configuration using either an analytics_google or an analytics_plausible key.
See Site Options for more on site options and how to set them.
Google Analytics¶
Use the site.options.analytics_google configuration, with the contents being your Measurement ID (G-XXXXXX) or Tracking ID (UA-XXXXXX).
version: 1
site:
options:
analytics_google: UA-XXXXX # Measurement ID or Tracking IDWhen setting an option from a page, omit the options: key - put it directly under site:, not site.options:. See Page Options.
See Google Analytics docs for more information on how to find this Measurement ID.
Plausible¶
Use the site.options.analytics_plausible configuration, with the contents being the domain you are tracking.
version: 1
site:
options:
analytics_plausible: mystmd.org # Domain(s) to trackWhen setting an option from a page, omit the options: key - put it directly under site:, not site.options:. See Page Options.
See Plausible docs for more information on how to find the domain. Note, you only copy in the contents of: data-domain="COPY_THIS", which can be a comma-separated list for multiple domains.
Testing your integration¶
Run myst start and view the page source. The analytics section should be in the <head> section of the HTML, you should also start to see real-time tracking in your dashboard.