Metadata-Version: 2.5
Name: django-sitemetrics
Version: 1.3.0
Summary: Reusable application for Django providing easy means to integrate site metrics counters into your sites
Project-URL: Homepage, https://github.com/idlesign/django-sitemetrics
Project-URL: Documentation, https://django-sitemetrics.readthedocs.io/
Author-email: Igor Starikov <idlesign@yandex.ru>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: Django,analytics,metrics
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# django-sitemetrics

<https://github.com/idlesign/django-sitemetrics>

[![release](https://img.shields.io/pypi/v/django-sitemetrics.svg)](https://pypi.python.org/pypi/django-sitemetrics)
[![lic](https://img.shields.io/pypi/l/django-sitemetrics.svg)](https://pypi.python.org/pypi/django-sitemetrics)
[![coverage](https://img.shields.io/coveralls/idlesign/django-sitemetrics/master.svg)](https://coveralls.io/r/idlesign/django-sitemetrics)

## What's that

Reusable application for Django providing easy means to integrate site metrics counters into your sites.

## Built-in site metrics providers

1. **Yandex Metrika** — <https://metrika.yandex.ru/>

    Provider alias: `yandex`

2. **Google Analytics** — <https://www.google.com/analytics/>

    Provider alias: `google`

3. **Openstat** — <https://www.openstat.com/>

    Provider alias: `openstat`

## How to use

1. Add the `sitemetrics` application to `INSTALLED_APPS` in your settings file (usually `settings.py`)
2. Add `{% load sitemetrics %}` tag to the top of a template (usually base template, e.g. `_base.html`)

Then you have two options to add metrics counter code to your page:

* Use `four arguments` sitemetrics tag notation:

    ```html
    {% sitemetrics by google for "UA-000000-0" %}
    ```

    Here: `google` is a metrics provider alias; `UA-000000-0` — metrics counter keycode.

    That is how you put Google Analytics counter code (with `UA-000000-0` keycode) into page.

* Use `no arguments` sitemetrics tag notation:

    ```html
    {% sitemetrics %}
    ```

    That is how you put all counter codes registered and active for the current site.

    Client codes are registered with sites through Django Admin site interface.

    **Admin site** and **Sites** from Django contribs **are required** for this approach to work.

    Use `./manage.py migrate` to install sitemetrics tables into your database.

## Documentation

<https://django-sitemetrics.readthedocs.io/>
