Datasette plugin that adds Google Analytics tracking code to your Datasette instance
Reason this release was yanked:
The current version is not functioning as intended. Please use 0.1.2 and above.
Project description
datasette-google-analytics
A Datasette plugin that adds Google Analytics tracking code to your Datasette instance.
Installation
Install this plugin in the same environment as Datasette:
pip install datasette-google-analytics
Usage
Configure the plugin by adding a metadata.json file with your Google Analytics tracking ID:
{
"plugins": {
"datasette-google-analytics": {
"tracking_id": "G-XXXXXXXXXX"
}
}
}
Replace G-XXXXXXXXXX with your actual Google Analytics 4 tracking ID.
Then start Datasette with:
datasette --metadata metadata.json your-database.db
Development
To set up this plugin locally:
cd datasette-google-analytics
python -m venv venv
source venv/bin/activate
pip install -e '.[test]'
How This Works
- The plugin creates a custom template that extends the default base template
- It uses the
extra_template_varshook to pass the Google Analytics tracking ID to the template - It uses the
prepare_jinja2_environmenthook to modify the Jinjia2 environment by adding our template directories - The custom template adds the Google Analytics tracking code in the
extra_headblock
This approach follows Google's recommendations for placing the tracking code immediately after the <head> element.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datasette_google_analytics-0.1.1.tar.gz.
File metadata
- Download URL: datasette_google_analytics-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51f8baa2eb75f292d1dbe8175d01f6540bc9924b6b6808063589edf4f89785e9
|
|
| MD5 |
f0a857957ea04f8955edfc3097877925
|
|
| BLAKE2b-256 |
e3b3a11ab12bb1ec5349bab07688af9a9c8078ed74e48567faeba37fec4e2c6b
|
Provenance
The following attestation bundles were made for datasette_google_analytics-0.1.1.tar.gz:
Publisher:
release.yml on ngshiheng/datasette-google-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_google_analytics-0.1.1.tar.gz -
Subject digest:
51f8baa2eb75f292d1dbe8175d01f6540bc9924b6b6808063589edf4f89785e9 - Sigstore transparency entry: 203599656
- Sigstore integration time:
-
Permalink:
ngshiheng/datasette-google-analytics@0c394b6a4ec281f3b11d6e0defd3291ae2922f24 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ngshiheng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0c394b6a4ec281f3b11d6e0defd3291ae2922f24 -
Trigger Event:
push
-
Statement type:
File details
Details for the file datasette_google_analytics-0.1.1-py3-none-any.whl.
File metadata
- Download URL: datasette_google_analytics-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc5b186ef533912dbc4708a4ea1a9b560ffedf2eb2509cfe7c30831da544eb92
|
|
| MD5 |
ef2e7795892a1f258c3f5e562c6115b3
|
|
| BLAKE2b-256 |
d44f720d634936ca63a8807b432c74018d65d8998744e4f251971d64d4569bda
|
Provenance
The following attestation bundles were made for datasette_google_analytics-0.1.1-py3-none-any.whl:
Publisher:
release.yml on ngshiheng/datasette-google-analytics
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
datasette_google_analytics-0.1.1-py3-none-any.whl -
Subject digest:
dc5b186ef533912dbc4708a4ea1a9b560ffedf2eb2509cfe7c30831da544eb92 - Sigstore transparency entry: 203599658
- Sigstore integration time:
-
Permalink:
ngshiheng/datasette-google-analytics@0c394b6a4ec281f3b11d6e0defd3291ae2922f24 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ngshiheng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0c394b6a4ec281f3b11d6e0defd3291ae2922f24 -
Trigger Event:
push
-
Statement type: