Skip to main content

Install

pip install django-ga4-serverside

Settings

INSTALLED_APPS = [
        # …
        'django_ga4_serverside',
]

MIDDLEWARE = [
        # …
        'django_ga4_serverside.middleware.TrackingMiddleware',
]

GA4_ID = 'G-XXXXXXXXXX'
GA4_SECRET = 'XXXXXXXXXX-XXXXXXXXXXX'
GA4_DEBUG = False

Advanced settings

GA4_IGNORE_URL_REGEX - allows to configure ignored URLs

GA4_PROCESS_ANALYTICS - callback used to modify payload. Default implementation configures client_id from cookies. Default implementation:

def process_analytics(context):
        client_id, created = get_or_create_client_id(context.request)
        if created:
                store_user_cookie(context.response, client_id)
        store_parameters(context.request, client_id=client_id)

GA4_GENERATE_PAYLOAD - callback to generate payload

GA4_SHOULD_TRACK_CALLBACK - callback to filter tracked requests

API

Storing custom events

from django_ga4_serverside.utils import store_event

# inside view

store_event('custom_event', {'custom': 'property'})

Metadata

Release files for django-ga4-serverside 0.0.2

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-ga4-serverside 0.0.2
File Size Uploaded Provenance
django_ga4_serverside-0.0.2.tar.gz 6.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-ga4-serverside 0.0.2
File Interpreter ABI Platform
django_ga4_serverside-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / django_ga4_serverside-0.0.2.tar.gz

Download URL django_ga4_serverside-0.0.2.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a7acaa12884d05b81f93c5503fc6826ad2b97f0292a2c272e4f4a3567855da9b
BLAKE2b-256 checksum
How to use checksums
15980973f95016110ddf04bb83992d30f454161750676e0c04eec0c9e987d1a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.10

Release files / django_ga4_serverside-0.0.2-py3-none-any.whl

Download URL django_ga4_serverside-0.0.2-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d90cb19651c1266127a34460f671a0cc65bc93e28d24f1145231e33c98a1dbab
BLAKE2b-256 checksum
How to use checksums
bffe6e22a3adff365ee700d226525fdfae7568f0a1a4ea3da566a46389a6ec07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.10

Security for django-ga4-serverside 0.0.2

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.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files No provenance

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