Skip to main content

Simple Analytics template tags for Django

Project description

Simple Analytics logo

Django Plugin

Want privacy friendly analytics for Django? You're at the right place.

You need an account on Simple Analytics to see your stats collected by this plugin.

Installing it

Install the plugin:

pip install simpleanalytics

Using it

Add the package to the INSTALLED_APPS:

INSTALLED_APPS = [
   ...,
   simpleanalytics,
]

Next use the templatetag in your template:

<!DOCTYPE html>
{% load static simpleanalytics_tags %}
<html>
	<head>
		<meta charset="utf-8">
		<title>{% block page_title %}{{ site.name }}{% endblock %}</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    ...
    {% simpleanalytics_sync %}
    ...
    </head>
</html>

This will translate to roughly this:

<!DOCTYPE html>

<html>
	<head>
		<meta charset="utf-8">
		<title>brwnppr.com</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    ...
    <script type="text/javascript" src="https://scripts.simpleanalyticscdn.com/latest.js"></script>
    ...
    </head>
</html>

More

This app has four templatetags:

  • simpleanalytics_sync
  • simpleanalytics_async

simpleanalytics_sync converts to a plain <script> tag without the async keyword.

simpleanalytics_async converts to a plain <script> tag with the async keyword.

Compatibility

Tested on Django 2.2, but we think this should run on any recent Django deployment. Please raise an issue when it doesn't.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simpleanalytics-1.0.8.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simpleanalytics-1.0.8-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file simpleanalytics-1.0.8.tar.gz.

File metadata

  • Download URL: simpleanalytics-1.0.8.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for simpleanalytics-1.0.8.tar.gz
Algorithm Hash digest
SHA256 5f5bf8dd862036d385c759c8fdb6bae8318fc4393b62dc31d04a74a33d97cc84
MD5 a85ff4c9813eda10000a00e1bbbddccc
BLAKE2b-256 5977bc797953d01fcbff9450715a39a73ef1803a2927e5bced67bd46f36268c6

See more details on using hashes here.

File details

Details for the file simpleanalytics-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for simpleanalytics-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fe5d595ba65fe14c33ddd5d81e577af06a3d2318769860ea6368127a1e530aa6
MD5 cc0794734e76f6751f7d7e13b2b443df
BLAKE2b-256 df89e4e9af75a64158f726d3a8a7b17f3f9fd5621a2f1ae9d96dd1a34754902c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page