Skip to main content

Sphinx extension for plausible.io analytics

Project description

Sphinx extension for plausible.io

This extension adds the https://plausible.io script tags to a Sphinx project. It doesn't change the template, it uses the standard Sphinx hooks to insert javascript directly into any template (that uses the standard Sphinx stuff).

This is currently being tested but in production, please verify it does the correct thing for you.

Installation

Install the Python package: on pip it is sphinx-plausible.

Usage

Add sphinx_plausible to extensions:

extensions = [
    "sphinx_plausible",
]

Configuration options:

  • plausible_domain (required): The domain name, like my.domain.org. Can be a list which will be joined by commas.

  • plausible_script (default https://plausible.io/js/script.js): The URL to the script to load If you want to use the "proxying the script" idea, download the script and put it in html_static_path and add the filename (relative to html_static_path) here instead of the absolute path. (in the future we can automatically download and cache)

  • plausible_enabled (default True): Should plausible be active? You might want to disable it on all you test deployments and so on. Default True. You can limit to only the official deployment with something such as:

    import os
    plausible_enabled = (
        'GITHUB_ACTION' in os.environ
        and os.environ.get('GITHUB_REPOSITORY', '').lower() == 'aaltoscicomp/scicomp-docs'
        and os.environ.get('GITHUB_REF') == 'refs/heads/master'
        )
    

Status and development

Beta but works as of 2022 - improvements and feature requests are still welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_plausible-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

sphinx_plausible-0.1.0-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sphinx_plausible-0.1.0.tar.gz.

File metadata

  • Download URL: sphinx_plausible-0.1.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.28.1

File hashes

Hashes for sphinx_plausible-0.1.0.tar.gz
Algorithm Hash digest
SHA256 243400e30186c36b147ded4aeea1f6ae67007dc73892751b271bdc41b71eccb2
MD5 07c15f416c0f1ad227ea5f38e10969f1
BLAKE2b-256 115e151dda5182e77adfda6350babf378efbdf619f629475dd05c31a3f53e31f

See more details on using hashes here.

File details

Details for the file sphinx_plausible-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_plausible-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c27ed4c6c23577a5ee9ee613ac09054276963a8842cd58933f9335c4e3e8b112
MD5 8b3e8d6fdf4a1fec3c5a4481f5f5b9dc
BLAKE2b-256 a0ee0d0d13683cc7854fbf76e17e9ebd88df1862cc0877842fc389d0e39bb4a4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page