django-plausible


Namedjango-plausible JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/RealOrangeOne/django-plausible
SummaryDjango module to provide easy Plausible integration, with Wagtail support
upload_time2023-05-12 15:20:05
maintainer
docs_urlNone
authorJake Howard
requires_python>=3.7
licenseBSD
keywords django plausible wagtail analytics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-plausible

![CI](https://github.com/RealOrangeOne/django-plausible/workflows/CI/badge.svg)
![PyPI](https://img.shields.io/pypi/v/django-plausible.svg)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-plausible.svg)
![PyPI - Status](https://img.shields.io/pypi/status/django-plausible.svg)
![PyPI - License](https://img.shields.io/pypi/l/django-plausible.svg)


Django module to provide easy [Plausible](https://plausible.io/) integration, with [Wagtail](https://wagtail.io/) support.

## Installation

```
pip install django-plausible
```

Then simply add `plausible` to `INSTALLED_APPS`.

## Usage

`django-plausible` provides a `plausible` template tag, which can be used to output the required [script tag](https://plausible.io/docs/plausible-script) for Plausible.

```html
{% load plausible %}

{% plausible %}
```

Will result in:

```html
<script defer data-domain="example.com" src="https://plausible.io/js/plausible.js"></script>
```

### Configuration

Configuration can be changed either in `settings.py`, or when calling the `plausible` template tag:

- `PLAUSIBLE_DOMAIN`: The domain Plausible is running on (defaults to `plausible.io`)
- `PLAUSIBLE_SCRIPT_NAME`: The name of the script to use (defaults to `plausible.js`). See [script extensions](https://plausible.io/docs/script-extensions) for available options.

These settings will affect all calls to the `plausible` template tag. To override it at call time, you can also pass them into the template tag:

```
{% plausible plausible_domain="my-plausible.com" script_name="plausible.hash.js" %}
```

By default, the domain (`data-domain`) used will be based on the request's hostname (using [`request.get_host()`](https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.get_host)). To override this, pass `site_domain` to the template tag.

If the ["compat" script](https://plausible.io/docs/script-extensions#plausiblecompatjs) is used, `django-plausible` will automatically add the required `id` to the `script` tag. It is excluded by default to help hide Plausible's presence.

## Usage with Wagtail

Additionally, `django-plausible` provides an (optional) deep integration with [Wagtail](https://wagtail.io), allowing configuration through the Wagtail admin. To enable this, additionally add `plausible.contrib.wagtail` to `INSTALLED_APPS`.

Configuration is done through the "Plausible Analytics" [setting](https://docs.wagtail.io/en/stable/reference/contrib/settings.html#settings):

- `site_domain`: the value for `data-domain`. If left blank (the default), the request's hostname will be used (as above), **not** the site hostname.
- `plausible_domain`: The domain Plausible is running on (as above)
- `script_name`: The name of the script to use (as above)

To access the template tag, load `plausible_wagtail`, rather than `plausible`. The template tag itself is still `plausible`. Note that unlike the Django variant, the Wagtail template tag doesn't allow options to be passed.

```html
{% load plausible_wagtail %}

{% plausible %}
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RealOrangeOne/django-plausible",
    "name": "django-plausible",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "django plausible wagtail analytics",
    "author": "Jake Howard",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f0/49/6369ba0ba1c4f767f064ed03ae48a7ac795d45f5a61ce1efb6aad623b872/django-plausible-0.5.0.tar.gz",
    "platform": null,
    "description": "# django-plausible\n\n![CI](https://github.com/RealOrangeOne/django-plausible/workflows/CI/badge.svg)\n![PyPI](https://img.shields.io/pypi/v/django-plausible.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-plausible.svg)\n![PyPI - Status](https://img.shields.io/pypi/status/django-plausible.svg)\n![PyPI - License](https://img.shields.io/pypi/l/django-plausible.svg)\n\n\nDjango module to provide easy [Plausible](https://plausible.io/) integration, with [Wagtail](https://wagtail.io/) support.\n\n## Installation\n\n```\npip install django-plausible\n```\n\nThen simply add `plausible` to `INSTALLED_APPS`.\n\n## Usage\n\n`django-plausible` provides a `plausible` template tag, which can be used to output the required [script tag](https://plausible.io/docs/plausible-script) for Plausible.\n\n```html\n{% load plausible %}\n\n{% plausible %}\n```\n\nWill result in:\n\n```html\n<script defer data-domain=\"example.com\" src=\"https://plausible.io/js/plausible.js\"></script>\n```\n\n### Configuration\n\nConfiguration can be changed either in `settings.py`, or when calling the `plausible` template tag:\n\n- `PLAUSIBLE_DOMAIN`: The domain Plausible is running on (defaults to `plausible.io`)\n- `PLAUSIBLE_SCRIPT_NAME`: The name of the script to use (defaults to `plausible.js`). See [script extensions](https://plausible.io/docs/script-extensions) for available options.\n\nThese settings will affect all calls to the `plausible` template tag. To override it at call time, you can also pass them into the template tag:\n\n```\n{% plausible plausible_domain=\"my-plausible.com\" script_name=\"plausible.hash.js\" %}\n```\n\nBy default, the domain (`data-domain`) used will be based on the request's hostname (using [`request.get_host()`](https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.get_host)). To override this, pass `site_domain` to the template tag.\n\nIf the [\"compat\" script](https://plausible.io/docs/script-extensions#plausiblecompatjs) is used, `django-plausible` will automatically add the required `id` to the `script` tag. It is excluded by default to help hide Plausible's presence.\n\n## Usage with Wagtail\n\nAdditionally, `django-plausible` provides an (optional) deep integration with [Wagtail](https://wagtail.io), allowing configuration through the Wagtail admin. To enable this, additionally add `plausible.contrib.wagtail` to `INSTALLED_APPS`.\n\nConfiguration is done through the \"Plausible Analytics\" [setting](https://docs.wagtail.io/en/stable/reference/contrib/settings.html#settings):\n\n- `site_domain`: the value for `data-domain`. If left blank (the default), the request's hostname will be used (as above), **not** the site hostname.\n- `plausible_domain`: The domain Plausible is running on (as above)\n- `script_name`: The name of the script to use (as above)\n\nTo access the template tag, load `plausible_wagtail`, rather than `plausible`. The template tag itself is still `plausible`. Note that unlike the Django variant, the Wagtail template tag doesn't allow options to be passed.\n\n```html\n{% load plausible_wagtail %}\n\n{% plausible %}\n```\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Django module to provide easy Plausible integration, with Wagtail support",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/RealOrangeOne/django-plausible"
    },
    "split_keywords": [
        "django",
        "plausible",
        "wagtail",
        "analytics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1d85ff0ece31b4c97971592e7f4d43803e63eb326b5f6235827daacb534193a",
                "md5": "e43dc8629bb4ae608eeb609950bfba56",
                "sha256": "d132371bafcf2b65afead0ac2eb65cf52d2e6260b22c2999c3a58d1fe60ca9b1"
            },
            "downloads": -1,
            "filename": "django_plausible-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e43dc8629bb4ae608eeb609950bfba56",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8609,
            "upload_time": "2023-05-12T15:20:03",
            "upload_time_iso_8601": "2023-05-12T15:20:03.846809Z",
            "url": "https://files.pythonhosted.org/packages/b1/d8/5ff0ece31b4c97971592e7f4d43803e63eb326b5f6235827daacb534193a/django_plausible-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0496369ba0ba1c4f767f064ed03ae48a7ac795d45f5a61ce1efb6aad623b872",
                "md5": "ef62eb820b4fcb88872a5b1f49428b77",
                "sha256": "c6fbeb1200a86f63cbe83f07e665202a29edeb6b46eb78b393372fb37b945330"
            },
            "downloads": -1,
            "filename": "django-plausible-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ef62eb820b4fcb88872a5b1f49428b77",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 6624,
            "upload_time": "2023-05-12T15:20:05",
            "upload_time_iso_8601": "2023-05-12T15:20:05.298401Z",
            "url": "https://files.pythonhosted.org/packages/f0/49/6369ba0ba1c4f767f064ed03ae48a7ac795d45f5a61ce1efb6aad623b872/django-plausible-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-12 15:20:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RealOrangeOne",
    "github_project": "django-plausible",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-plausible"
}
        
Elapsed time: 0.08690s