# Django Simple Analytics

[](https://github.com/psf/black)


Simple analytics is a very simple package to track requests done to the website and store them in database.
## Installation
From PYPi using `pip`:
```
pip install django-simple-analytics
```
## Usage
In order to install the package add the following line to `INSTALLED_APPS`
```python
INSTALLED_APPS = [
...
"simple_analytics",
]
```
This will make the model available for you to call and query. To enable the middleware, add this at the bottom of the middleware list:
```python
MIDDLEWARE = [
...
"simple_analytics.middleware.page_counts",
]
```
Then, you need to run migrations, finally:
```console
./manage.py migrate
```
To actually create the table in the database.
Now every request done to the django website will be recorded in the database with the following fields:
- Date: The date pf the request.
- Page: The path of the request.
- Method: The verb used to request the page.
- Whether the page exists or not.
- Origin: If the header exists in the requst, where the request originated.
- User: The user who performed the request. If the user is not authenticated, it will show as AnonymousUser.
- view_count: The number of requests to that page, per date and per method used.
## Licence
This package is distributed under [MIT Licence](./LICENCE).
Raw data
{
"_id": null,
"home_page": null,
"name": "django-simple-analytics",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "django, analytics",
"author": null,
"author_email": "Ferran Jovell <ferran.jovell+gh@gmail.com>",
"download_url": null,
"platform": null,
"description": "# Django Simple Analytics\n\n\n[](https://github.com/psf/black)\n\n\n\nSimple analytics is a very simple package to track requests done to the website and store them in database.\n\n## Installation\n\nFrom PYPi using `pip`:\n\n```\npip install django-simple-analytics\n```\n\n## Usage\n\nIn order to install the package add the following line to `INSTALLED_APPS`\n\n```python\nINSTALLED_APPS = [\n ...\n \"simple_analytics\",\n]\n```\n\nThis will make the model available for you to call and query. To enable the middleware, add this at the bottom of the middleware list:\n\n```python\nMIDDLEWARE = [\n ...\n \"simple_analytics.middleware.page_counts\",\n]\n```\n\nThen, you need to run migrations, finally:\n\n```console\n./manage.py migrate\n```\n\nTo actually create the table in the database.\n\nNow every request done to the django website will be recorded in the database with the following fields:\n\n- Date: The date pf the request.\n- Page: The path of the request.\n- Method: The verb used to request the page.\n- Whether the page exists or not.\n- Origin: If the header exists in the requst, where the request originated.\n- User: The user who performed the request. If the user is not authenticated, it will show as AnonymousUser.\n- view_count: The number of requests to that page, per date and per method used.\n\n## Licence\n\nThis package is distributed under [MIT Licence](./LICENCE).\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple django packages to track requests on the site",
"version": "1.1.0",
"project_urls": {
"Bug Tracker": "https://github.com/mrswats/django-simple-analytics/issues",
"homepage": "https://github.com/mrswats/django-simple-analytics"
},
"split_keywords": [
"django",
" analytics"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "fc92b4922d43b193ad7e28e690678575ef900f9113a85aeed040f738a3d2681d",
"md5": "51c2cff302eea3410aac6f92bc425d1c",
"sha256": "f2ae81c4d34392eea6b281c66419d884d61708b2b643876b25ff650047201455"
},
"downloads": -1,
"filename": "django_simple_analytics-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51c2cff302eea3410aac6f92bc425d1c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7255,
"upload_time": "2024-10-13T20:43:41",
"upload_time_iso_8601": "2024-10-13T20:43:41.647874Z",
"url": "https://files.pythonhosted.org/packages/fc/92/b4922d43b193ad7e28e690678575ef900f9113a85aeed040f738a3d2681d/django_simple_analytics-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-13 20:43:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mrswats",
"github_project": "django-simple-analytics",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "asgiref",
"specs": [
[
"==",
"3.5.2"
]
]
},
{
"name": "django",
"specs": [
[
"==",
"4.1.1"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.4.2"
]
]
}
],
"lcname": "django-simple-analytics"
}