Skip to main content

Django app to capture, track and display site analytics

Project description

[![Travis CI Build Status](https://travis-ci.org/analytehealth/django-analytics.svg?branch=development)](https://travis-ci.org/analytehealth/django-analytics)

django-analytics
================

Django app to capture, track and display site analytics

Install
-------
pip install dj-analytics

Add to django configuration
---------------------------
* Add `djanalytics` to `INSTALLED_APPS` in settings.py file.
* Run `manage.py migrate djanalytics` to create database tables.
* Create and configure at least one Client and Domain.
* In urls.py, include djanalytics urls. For example:

urlpatterns += patterns(
'',
(r'', include('djanalytics.urls'))
)

Use middleware
--------------

In settings.py, add 'djanalytics.middleware.AnalyticsMiddleware' to the MIDDLEWARE_CLASSES setting
for your django project.

Capture using HTML
------------------

var img_html = '<img src="http://dja_server.example.com/capture/' +
'?dja_id=[client uuid]' +
'&pth=' + escape(window.location.pathname) +
'&qs=' + escape(window.location.search.substr(window.location.search.indexOf('?')+1)) +
'&rf=' + escape(document.referrer) +
'" style="position:absolute; left: -999px"></img>";
document.write(img_html);

License
-------
[Read it here](https://raw.githubusercontent.com/analytehealth/django-analytics/master/LICENSE)

Change Log
----------
- 0.8
- Corrected name of user chart.
- Added try / except block around middleware to avoid 500 error when
client doesn't exist or can't be found.

- 0.7.1
- Fix for issue #5 - Created date on RequestEvent is storing the wrong date

- 0.7
- Fix for issue #3 - logic for determining valid domain in capture view is wrong.

- 0.6
- Added Location model object. This will allow geocoding of IP addresses on a periodic basis,
since IP addresses change over time.

- 0.5
- Fix for issue #1 - capture view raises TypeError
- Fix for issue #2 - allow for use of HTTP_X_FORWARDED_FOR header

- 0.4
- Switched version of django-graphos to fix install issue
- Added in files for Travis CI

- 0.3
- Added 'referrer' to RequestEvent model
- Added more indexes to RequestEvent model
- Added middleware documentation to README

- 0.2
- Switched default for RequestEvent created field to 'now()' instead of 'today()'

- 0.1
- Initial version

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

dj-analytics-0.8.tar.gz (14.4 kB view details)

Uploaded Source

File details

Details for the file dj-analytics-0.8.tar.gz.

File metadata

  • Download URL: dj-analytics-0.8.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for dj-analytics-0.8.tar.gz
Algorithm Hash digest
SHA256 b8e78efcd00759e08569fce67e0813cd14ced4a8cd6a8da16254f1b06107ac9d
MD5 a1060a16c2b5b2f3e03f55db63b17f58
BLAKE2b-256 490c32ad4d5336593515032d6793df769b2b1ecec17f7b652b0a3296edda7417

See more details on using hashes here.

Supported by

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