Skip to content

Commit

Permalink
fix: support modern plausible
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed May 21, 2024
1 parent 0120e45 commit fc4a809
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
18 changes: 12 additions & 6 deletions docs/advanced/html.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,21 @@ html:
[Plausible Analytics](https://plausible.io) is a lightweight, open source, [privacy-focused](https://plausible.io/privacy-focused-web-analytics) analytics service that can be used as a more ethical alternative (or, in addition to) to Google Analytics.
You can do this by adding the following in your configuration file:
Plausible Analytics requires a _domain_, which is given by the `plausible_analytics_domain` property:
```yaml
sphinx:
config:
html_js_files: [ ['https://plausible.io/js/script.js', {'defer': 'defer', 'data-domain': 'yourdomain.com'}] ]
html:
analytics:
plausible_analytics_domain: my-domain
```
You can specify the analytics script that is loaded; by default, the bundle from <https://plausible.io> is used:
```yaml
html:
analytics:
plausible_analytics_domain: my-domain
plausible_analytics_url: https://plausible.io/js/script.js
```

This should inject the appropriate code into the `<head>` via javascript, and you will be able to get analytics on your website through either the commercial company-hosted dashboard, or a [self-hosted instance](https://plausible.io/docs/self-hosting).
This should inject the appropriate code into the built site, and you will be able to get analytics on your website through either the commercial company-hosted dashboard, or a [self-hosted instance](https://plausible.io/docs/self-hosting).


(html:link-check)=
Expand Down
1 change: 1 addition & 0 deletions jupyter_book/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ html:
home_page_in_navbar : true # Whether to include your home page in the left Navigation Bar
baseurl : "" # The base URL where your book will be hosted. Used for creating image previews and social links. e.g.: https://mypage.com/mybook/
analytics:
plausible_analytics_url: https://plausible.io/js/script.js

comments:
hypothesis : false
Expand Down

0 comments on commit fc4a809

Please sign in to comment.