Overview
========
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/bruth/django-tracking2/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
django-tracking2 tracks the length of time visitors and registered users
spend on your site. Although this will work for websites, this is more
applicable to web _applications_ with registered users. This does
not replace (nor intend) to replace client-side analytics which is
great for understanding aggregate flow of page views.
**Note: This is not a new version of [django-tracking]. These apps
have very different approaches and, ultimately, goals of tracking users.
This app is about keeping a history of visitor sessions, rather than the
current state of the visitor.**
[django-tracking]: https://github.com/codekoala/django-tracking
Requirements
============
* Django's [session framework][1] installed
* [South][2] (if you want to use the packaged migrations)
[1]: https://docs.djangoproject.com/en/1.3/topics/http/sessions/
[2]: http://pypi.python.org/pypi/South
Download
========
```bash
pip install django-tracking2
```
Setup
=====
Add `tracking` to your project's `INSTALLED_APPS` setting:
```python
INSTALLED_APPS = (
...
'tracking',
...
)
```
Add `tracking.middleware.VisitorTrackingMiddleware` to your project's
`MIDDLEWARE_CLASSES` before the `SessionMiddleware`:
```python
MIDDLEWARE_CLASSES = (
...
'tracking.middleware.VisitorTrackingMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
...
)
```
Settings
--------
`TRACK_AJAX_REQUESTS` - If True, AJAX requests will be tracked. Default
is False
`TRACK_ANONYMOUS_USERS` - If False, anonymous users will not be tracked.
Default is True
`TRACK_PAGEVIEWS` - If True, individual pageviews will be tracked.
`TRACK_IGNORE_URLS` - A list of regular expressions that will be matched
against the `request.path_info` (`request.path` is stored, but not matched
against). If they are matched, the pageview record will not be saved. Default
includes 'favicon.ico' and 'robots.txt'. Note, static and media are not included
since they should be served up statically Django's static serve view or via
a lightweight server in production. Read more
[here](https://docs.djangoproject.com/en/dev/howto/static-files/#serving-other-directories)
`TRACK_IGNORE_STATUS_CODES` - A list of HttpResponse status_codes that will be ignored.
If the HttpResponse object has a status_code in this blacklist, the pageview record
will not be saved. For example,
```python
TRACK_IGNORE_STATUS_CODES = [400, 404, 403, 405, 410, 500]
```
`TRACK_REFERER` - If True, referring site for all pageviews will be tracked. Default is False
Views
-----
To view aggregate data about all visitors and per-registered user stats,
do the following:
Include `tracking.urls` in your `urls.py`:
```python
urlpatterns = patterns('',
...
url(r'^tracking/', include('tracking.urls')),
...
)
```
These urls are protected by a custom Django permission `tracking.view_visitor`.
Thus only superusers and users granted this permission can view these pages.
Available URLs
--------------
* `/dashboard/` - overview of all visitor activity
Templates
---------
* `tracking/dashboard.html` - for the dashboard page
* `tracking/snippets/stats.html` - standalone content for the dashboard page
(simplifies overriding templates)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
资源分类:Python库 所属语言:Python 资源全名:django-tracking2-0.1.11.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
资源推荐
资源详情
资源评论
收起资源包目录
django-tracking2-0.1.11.tar.gz (33个子文件)
django-tracking2-0.1.11
MANIFEST.in 68B
PKG-INFO 655B
tracking
models.py 3KB
managers.py 9KB
utils.py 6KB
templates
tracking
snippets
stats.html 4KB
dashboard.html 577B
middleware.py 3KB
compat.py 232B
__init__.py 502B
migrations
0007_auto__chg_field_pageview_url.py 5KB
0008_auto__chg_field_visitor_user__add_field_pageview_referer.py 9KB
0002_auto__add_field_visitor_expiry_age.py 4KB
__init__.py 0B
0003_auto__add_field_visitor_time_on_site__chg_field_visitor_expiry_time__c.py 5KB
0005_auto__add_pageview.py 5KB
0004_auto__chg_field_visitor_user_agent.py 5KB
0001_initial.py 5KB
0006_auto__add_field_pageview_method.py 5KB
settings.py 680B
handlers.py 1KB
views.py 3KB
admin.py 956B
urls.py 178B
cache.py 977B
django_tracking2.egg-info
PKG-INFO 655B
requires.txt 16B
SOURCES.txt 1KB
top_level.txt 9B
dependency_links.txt 1B
setup.cfg 59B
setup.py 991B
README.md 3KB
共 33 条
- 1
资源评论
挣扎的蓝藻
- 粉丝: 14w+
- 资源: 15万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功