Skip to content

Add config settings for google analytics#348

Open
erinxocon wants to merge 1 commit intomasterfrom
add-google-analytics
Open

Add config settings for google analytics#348
erinxocon wants to merge 1 commit intomasterfrom
add-google-analytics

Conversation

@erinxocon
Copy link
Member

To get better insight on page views and SEO optimizations, we want to gather some page statistics from google analytics.

@jacobgkau jacobgkau requested a review from a team March 24, 2026 15:56
@jacobgkau jacobgkau force-pushed the add-google-analytics branch from 81ec48a to e3be1fb Compare March 24, 2026 15:56
Copy link
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This causes the book to fail to start:
ERROR Failed to deserialize `output.html`
	Caused by: unknown field `google-analytics`, expected one of `theme`, `default-theme`, `preferred-dark-theme`, `smart-punctuation`, `definition-lists`, `admonitions`, `mathjax-support`, `additional-css`, `additional-js`, `fold`, `playground`, `playpen`, `code`, `print`, `no-section-label`, `search`, `git-repository-url`, `git-repository-icon`, `input-404`, `site-url`, `cname`, `edit-url-template`, `live-reload-endpoint`, `redirect`, `hash-files`, `sidebar-header-nav`

That's because the google-analytics option was removed in version 0.5 of mdbook (see also rust-lang/mdBook#1675 & rust-lang/mdBook#2776).

Instead of doing this, we need to add a head.hbs file in the theme directory, and put whatever code snippit you need in there. That file will be put into <head>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants