Skip to main content

django-usefathom

Fathom Analytics integration with Django projects. Provides ability to integrate page view tracking and goal reporting.

If you want to track goals instead of events, please use the 1.x.x version of the library.

Installation

Install the package:

pip install django-usefathom

Add usefathom to your settings.py file:

INSTALLED_APPS = [
    # ...
    "usefathom",
    # ...
]

Add template processor to your settings.py file:

TEMPLATES = [
    {
        # ....
        "OPTIONS": {
            "context_processors": [
                # ...
                "usefathom.context_processors.usefathom",
                # ...
            ],
        },
    },
]

Add your fathom site id to your settings.py file:

FATHOM_SITE_ID = "XXXX1234"

Include tracking snippet in your templates:

{% include "usefathom/usefathom.html" %}

From this point your site visits will be tracked.

Event Tracking

Python

Now if you want to report a event from your backend service to Fathom analytics:

import usefathom

def some_view(request, *args, **kwargs):
    # anywhere you have request object, most likely views are a good place for this
    usefathom.track(request, "add_to_card", 100)  # Third parameter is optional integer, attaches the monetary value to the event in cents

And the goal will be reported to Fathom analytics on the next page load.

HTML+JS

You can use template tags to track the goals from the html. It's useful when tracking external link clicks, etc.

{% load fathom }
......with link
<a href="https://go-somewhere.com/link" {% click_event "somewhere_link_clicked" 100 %}>Go somewhere?</a>
......with form
<form method="POST" {% submit_event "registration_submit" %}>

Metadata

Release files for django-usefathom 2.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-usefathom 2.0.3
File Size Uploaded Provenance Actions
django_usefathom-2.0.3.tar.gz 3.7 kB Without provenance Details for django_usefathom-2.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-usefathom 2.0.3
File Interpreter ABI Platform Actions
django_usefathom-2.0.3-py3-none-any.whl Python 3 none any Details for django_usefathom-2.0.3-py3-none-any.whl

Total release size: 9.5 kB

Release files / django_usefathom-2.0.3.tar.gz

Download URL django_usefathom-2.0.3.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bb852d07060173aabd2d19ae9190b79e8dff8cb0f6f212eff82b1d7514e76f72
BLAKE2b-256 checksum
How to use checksums
efc9984d84f0a0b14aafec02c608361011f9e40abe06ec1e03af58474b86a6ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/6.7.11-orbstack-00143-ge6b82e26cd22

Release files / django_usefathom-2.0.3-py3-none-any.whl

Download URL django_usefathom-2.0.3-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01357777861bd543a3c1659776c44c99a47a8fdb02fcc90df776ca6e2c2f796d
BLAKE2b-256 checksum
How to use checksums
5e93a4facca7f5a6e9fb46bdd18b8818f6d831a7c7d5284e63b8530ec2a1c5ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.9 Linux/6.7.11-orbstack-00143-ge6b82e26cd22

Security for django-usefathom 2.0.3

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page