|Johann Schmitz fb9d5db867 Version 0.1.11||2 anni fa|
|django_pypiwik||2 anni fa|
|.gitignore||2 anni fa|
|LICENSE.txt||4 anni fa|
|Makefile||2 anni fa|
|README.md||3 anni fa|
|requirements.txt||4 anni fa|
|setup.py||2 anni fa|
|sonar-project.properties||2 anni fa|
django-pypiwik is a django helper application around pypiwik.
django-piwik can be configured at the application level (
settings.py) or on a per-site level.
It requires the Site framework to be installed and configured.
Global configuration in
PIWIK_URL="http://yourpiwikhost/piwik/" PIWIK_SITE_ID = 1
django-pypiwik installs the
Piwik configuration model. Use this model to connect your Django site with an Piwik site.
PIWIK_TRACKING_MIDDLEWARE_EXCLUDE_ADMIN option controls whether requests in the Django admin site should be tracked or not.
PiwikMixin brings an easy to use interface to your views:
class IndexView(PiwikMixin, TemplateView): template_name = 'index.html'
PiwikMixin adds a
DjangoPiwikTracker instance to the
piwik_tracker. To render the tracking code in your template, call
tracking_code on it:
django-piwik also accepts callables as tracking variables. The code above is equivalent to the following:
django-pypiwik includes a decorator called
track_page_view decorator. So watch out which one is listed in your imports.
dispatch method on your views (if you are using class based views):
track_page_view decorator will not honor the
piwik_* variables defined on your view. Instead, pass them to the decorator:
PiwikTrackingMiddleware to track page views by including
django_pypiwik.middleware.PiwikTrackingMiddleware in your
MIDDLEWARE_CLASSES. The middleware sends a server-to-server tracking call in the
PIWIK_TRACKING_MIDDLEWARE_PARAMS option (a dict) in your settings.py let you control other tracking parameters to send to Piwik.
token_auth parameter, required for some tracking variables, can be defined at three levels:
settings.py. This is the default
token_authvalue for all sites
settings.py. Same as 1 but allows you to define other default parameters too.