Account and API Keys

The keys key accepts a map of name-value pairs that specify account identifiers used for service integrations such as Google Analytics or search tools.

keys key

The keys key is optional. You define the keys key under the site key in a playbook. keys accepts a list of name-value pairs (aka subkeys) that specify account identifiers.

Example 1. antora-playbook.yml
site:
  title: Site Title
  url: https://example.org
  keys:
    name-of-account-key: 'identifier'
    google_analytics: 'XX-123456'

The value of these keys can then be accessed by a UI template from the site.keys property in the UI model. When assigned to the UI model, the name is converted to camelCase (regardless of whether words in the name are separated using hyphens or underscores). For example, you can access the keys defined in the example above as site.keys.nameOfAccountKey and site.keys.googleAnalytics, respectively.

Add a Google analytics account

The google_analytics key assigns a Google Analytics account to the site. Setting this option implicitly enables the Google Analytics / Tag Manager embed code when using the default UI.

Example 2. antora-playbook.yml
site:
  title: Demo Docs Site
  url: https://demo.antora.org
  keys:
    google_analytics: 'XX-123456'

We recommend enclosing the value in single quotation marks (') to prevent it from being mangled by the YAML parser.