sites-conformes-posthog
Charge et configure PostHog sur toutes les pages, et identifie les utilisateurs connectés au CMS afin de pouvoir exclure l'équipe des insights (comme sur quefairedemesobjets).
La configuration vit dans le code, pas dans Réglages → Scripts : elle
passe par le proxy nginx du site (api_host: "/ph", voir
infra/scalingo-proxy/servers.conf.erb) et ne doit pas dériver au gré des
synchronisations de contenu. Ne collez donc pas de posthog.init(...)
dans les scripts personnalisés - il ferait doublon.
Réglages
POSTHOG_KEY(settings Django, depuis la variable d'environnement du même nom) : la clé de projet. Vide = pas de PostHog (dev, tests). En prod elle arrive par OpenTofu (var.posthog_key, variable GitHubPOSTHOG_KEY).
Installation
uv add sites-conformes-posthog
Ce package surcharge sites_conformes_core/base.html (fourni par
sites_conformes). Il doit être placé avant sites_conformes dans
INSTALLED_APPS :
INSTALLED_APPS = [
...,
"sites_conformes_posthog",
"sites_conformes",
"sites_conformes.core",
...,
]
Deux blocs sont étendus avec {{ block.super }} : tracking (dans le
<head>, loader + posthog.init) et body_tracking_scripts
(posthog.identify si request.user.is_authenticated).
Configuration côté PostHog
Dans PostHog → Project Settings → Filter out internal and test users, ajouter un filtre pour exclure l'équipe, par exemple :
email contains "@beta.gouv.fr"
ou tout autre critère basé sur email/admin, les deux propriétés
envoyées par posthog.identify().
Metadata
Release files for sites-conformes-posthog 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sites_conformes_posthog-0.1.0.tar.gz | 4.7 kB | With provenance | Details for sites_conformes_posthog-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sites_conformes_posthog-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sites_conformes_posthog-0.1.0-py3-none-any.whl |
Total release size: 10.8 kB
Release files / sites_conformes_posthog-0.1.0.tar.gz
| Download URL | sites_conformes_posthog-0.1.0.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51e3724d7b00af238bc4a4f254be6d68acab3d8c6438d930643d4eb8c4c86a3c
|
|
BLAKE2b-256 checksum How to use checksums |
df35c44600ca5106c7007452a325d1fadb4969572fa24aa7c6e9110e9e65cb9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logRelease files / sites_conformes_posthog-0.1.0-py3-none-any.whl
| Download URL | sites_conformes_posthog-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92b8bfc48889bea3264bf15360e67d8ab568910b73a30afe947a36ee533dae94
|
|
BLAKE2b-256 checksum How to use checksums |
02712509de24da3260b6aafbec49ec9244867d9bc1a8bc30316914d107768d79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logSecurity for sites-conformes-posthog 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sites_conformes_posthog-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.