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.7.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

simpleanalytics-1.0.7-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: simpleanalytics-1.0.7.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for simpleanalytics-1.0.7.tar.gz
Algorithm Hash digest
SHA256 6d074277993cb3780544fac13abcce11d55418c73b8c3f7dc3ee693d533fd65b
MD5 6f66be7a9d794788fa4778c0e384f677
BLAKE2b-256 e32e5d32fb21e41f704c70c0601aeebc795260e25c69e2a51af97e5e7ae9d194

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for simpleanalytics-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d2a05f0c9fa98c89279f7f66f0c7936e0cfdac992a1330a40a82ad109fbfb0d9
MD5 fd9fa9bb0af39542f581359c855cc174
BLAKE2b-256 ca43a8d86f7d005c0c6c326f74fd6aac247b6973d47641224af3573a60e9f019

See more details on using hashes here.

Supported by

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