Commits

ken cochrane committed 47a5356

Initial checkin

  • Participants

Comments (0)

Files changed (19)

+syntax: glob
+*.pyc
+dist
+MANIFEST
+_build
+_static
+.DS_Store

File CONTRIBUTORS

+People who have worked on django-clickstream
+---------------------------------------
+Ken Cochrane - initial code
+Copyright (c) 2011, Ken Cochrane
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of the author nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+==================
+Django ClickStream
+==================
+
+Track a visitors movements across your site.
+
+Possible uses:
+* See what they were doing before they got an error.
+* Use it for analytics and usability testing to see how people are moving around your site, and where you are losing people.
+
+Inspired by OpenSymphony's Java project of the same name. http://code.google.com/p/clickstream/ 
+
+Requirements
+------------
+* Django 1.1 or newer
+* Django sessions need to be enabled
+* Django south 0.7 or newer for migrations
+
+--------
+Settings
+--------
+
+Custom Settings
+===============
+Add the following properties to your settings file if you want to override the default settings.
+
+# CLICKSTREAM_IGNORE_PATHS
+# Default = ()
+# Takes a list of regular expressions for paths that you want to ignore
+# if it is picked up by these clicks won't be tracked.
+CLICKSTREAM_IGNORE_PATHS = ('^/private/',
+                            '^/dont-track-me/',
+                            'super-secret.txt',
+                            )
+
+# CLICKSTREAM_IGNORE_ANONYMOUS
+# Default = False
+# If you only want to track people that are logged in, change to True
+CLICKSTREAM_IGNORE_ANONYMOUS = False
+
+#CLICKSTREAM_IGNORE_IP
+# Default = ()
+# A list of IP's that you don't want to track
+CLICKSTREAM_IGNORE_IP = ('127.0.0.1', '10.10.10.10, '8.8.8.8')
+
+Middleware 
+==========
+Add 'clickstream.middleware.ClickStreamMiddleware' to your MIDDLEWARE_CLASSES settings 
+it needs to be after 'django.contrib.sessions.middleware.SessionMiddleware' in the list.
+
+App
+===
+Add clickstream to INSTALLED_APPS
+
+
+Sync Tables + Migrate
+=====================
+Run ./manage.py syncdb to load up the tables in your database.
+run ./manage.py migrate to run the south migrations

File clickstream/__init__.py

Empty file added.

File clickstream/admin.py

+from django.contrib import admin
+from clickstream.models import Stream, Click
+
+admin.site.register(Stream)
+admin.site.register(Click)

File clickstream/managers.py

+from django.db import models
+
+class StreamManager(models.Manager):
+    
+    def find_by_session(self, session_id):
+        self.filter(session_id=session_id)

File clickstream/middleware.py

+import re
+from datetime import datetime
+
+from django.conf import settings
+
+from clickstream.models import Stream, Click
+from clickstream.utils import ip_address_from_request
+
+# Ignore some common items we could care less about
+base_ignore_paths =  (
+        'favicon.ico',
+        'robots.txt',
+        '/admin/',
+        re.compile('^/static/'),
+    )
+
+# If there are some paths you don't want to track add them to 
+# CLICKSTREAM_IGNORE_PATHS
+IGNORE_PATHS = tuple([
+    unicode(i).__eq__ if isinstance(i, basestring) else i.search
+    for i in getattr(settings, 'CLICKSTREAM_IGNORE_PATHS', base_ignore_paths)
+])
+
+# Should we ignore anonoyous people and only track people logged in?
+IGNORE_ANONYMOUS = getattr(settings, 'CLICKSTREAM_IGNORE_ANONYMOUS', False)
+
+# A list of IP's that we want to ignore and not track.
+IGNORE_IP = dict([
+    (ip, True) for ip in getattr(settings, 'CLICKSTREAM_IGNORE_IP', ())
+])
+
+
+class ClickStreamMiddleware(object):
+    def process_request(self, request):
+        user_name = None
+        ip_address = None
+        url = None
+        ref = None
+        session_key = None
+
+        # If they are anonymous and we ignore anonymous don't go any further.
+        if request.user.is_anonymous() and IGNORE_ANONYMOUS:
+            return
+
+        ip_address = ip_address_from_request(request)
+
+        # If the ip address is on the ignore list, don't do anything.
+        if ip_address in IGNORE_IP:
+            return
+
+        # If the path is on the ignore path list, don't do anything.
+        for ignore in IGNORE_PATHS:
+            if ignore(request.path):
+                return
+
+        if not request.session:
+            # if there is no session, don't do anything.
+            return
+
+        session_key = request.session.session_key
+
+        url = request.build_absolute.uri()
+
+        if request.user and request.user.username:
+            user_name = request.user.username
+        else:
+            user_name = "Anonymous"
+        
+        if 'HTTP_REFERER' in request.META:
+            ref = request.META.get('HTTP_REFERER')
+
+        # get or create the stream.
+        stream, created = Stream.objects.get_or_create(session_key=session_key)
+        
+        # if it is new, save the other stuff.
+        if created:
+            stream.username = user_name
+            stream.ip_address = ip_address
+            stream.referrer = ref
+            stream.save()
+            
+        # Register the click
+        click = Click.objects.create(
+            stream = stream,
+            url = url,
+            path = request.path
+        )
+        
+        # all done, return nothing.
+        return

File clickstream/migrations/0001_initial.py

+from south.db import db
+from django.db import models
+from clickstream.models import *
+
+class Migration:
+    
+    def forwards(self, orm):
+        
+        # Adding model 'Stream'
+        db.create_table('clickstream_stream', (
+            ('id', orm['clickstream.Stream:id']),
+            ('session_key', orm['clickstream.Stream:session_key']),
+            ('username', orm['clickstream.Stream:username']),
+            ('ip_address', orm['clickstream.Stream:ip_address']),
+            ('referrer', orm['clickstream.Stream:referrer']),
+            ('create_date', orm['clickstream.Stream:create_date']),
+            ('last_update', orm['clickstream.Stream:last_update']),
+        ))
+        db.send_create_signal('clickstream', ['Stream'])
+        
+        # Adding model 'Click'
+        db.create_table('clickstream_click', (
+            ('id', orm['clickstream.Click:id']),
+            ('stream', orm['clickstream.Click:stream']),
+            ('url', orm['clickstream.Click:url']),
+            ('path', orm['clickstream.Click:path']),
+            ('create_date', orm['clickstream.Click:create_date']),
+        ))
+        db.send_create_signal('clickstream', ['Click'])
+    
+    
+    def backwards(self, orm):
+        
+        # Deleting model 'Stream'
+        db.delete_table('clickstream_stream')
+        
+        # Deleting model 'Click'
+        db.delete_table('clickstream_click')
+    
+    
+    models = {
+        'clickstream.click': {
+            'create_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'stream': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['clickstream.Stream']"}),
+            'url': ('django.db.models.fields.TextField', [], {})
+            'path': ('django.db.models.fields.TextField', [], {})
+        },
+        'clickstream.stream': {
+            'create_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'ip_address': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'last_update': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+            'referrer': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+            'session_key': ('django.db.models.fields.CharField', [], {'max_length': '40', 'unique': 'True'}),
+            'username': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'})
+        }
+    }
+    
+    complete_apps = ['clickstream']

File clickstream/migrations/__init__.py

Empty file added.

File clickstream/models.py

+from django.db import models
+from clickstream.managers import StreamManager
+
+class Stream(models.Model):
+    session_key = models.CharField(max_length=40, unique=True)
+    username = models.CharField(max_length=50, null=True, blank=True)
+    ip_address = models.CharField(max_length=40)
+    referrer = models.TextField(null=True, blank=True)
+    create_date = models.DateTimeField(auto_now_add=True)
+    last_update = models.DateTimeField(auto_now=True)
+    
+    objects = StreamManager()
+    
+class Click(models.Model):
+    stream = models.ForeignKey(Stream)
+    url = models.TextField()
+    path = models.TextField()
+    create_date = models.DateTimeField(auto_now_add=True)

File clickstream/tests.py

+""" TODO: Add Tests"""

File clickstream/utils.py

+
+def ip_address_from_request(request):
+    """ given a request object figure out the IP address 
+        TODO: Write tests
+    """
+    meta = request.META
+
+    # True-Client-IP comes from akamai's site accelorator converts to django 
+    if 'HTTP_TRUE_CLIENT_IP' in meta:
+        ip_address = meta.get('HTTP_TRUE_CLIENT_IP', '')
+    if 'REMOTE_ADDR' in meta and meta.get('REMOTE_ADDR', '') != '127.0.0.1':
+        ip_address = meta.get('REMOTE_ADDR', '')
+    elif 'HTTP_X_REAL_IP' in meta:
+        ip_address = meta.get('HTTP_X_REAL_IP', '')
+    elif 'HTTP_X_FORWARDED_FOR' in meta:
+        ip_address = meta.get('HTTP_X_FORWARDED_FOR', '')
+    else:
+        ip_address = meta.get('REMOTE_ADDR', None)
+
+    return ip_address

File clickstream/views.py

+# Create your views here.

File docs/Makefile

+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-visitor.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-visitor.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/django-visitor"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-visitor"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	make -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."

File docs/conf.py

+# -*- coding: utf-8 -*-
+#
+# django-visitor documentation build configuration file, created by
+# sphinx-quickstart on Tue Jul 26 07:25:04 2011.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('..'))
+
+import settings
+from django.core.management import setup_environ
+setup_environ(settings)
+
+# -- General configuration -----------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'django-clickstream'
+copyright = u'2011, Ken Cochrane and contributors'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.1'
+# The full version, including alpha/beta/rc tags.
+release = '0.1'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'django-clickstreamdoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'django-clickstream.tex', u'django-clickstream Documentation',
+   u'Ken Cochrane and contributors', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output --------------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+    ('index', 'django-clickstream', u'django-clickstream Documentation',
+     [u'Ken Cochrane and contributors'], 1)
+]

File docs/index.rst

+.. django-fitlog documentation master file, created by
+   sphinx-quickstart on Tue Aug 12 07:25:04 2011.
+
+Welcome to django-fitlog's documentation!
+=========================================
+
+Requirements
+------------
+
+Django 1.1 or newer
+
+Django sessions need to be enabled
+
+Django South 0.7 or newer
+
+
+Code Repo
+---------
+
+ * https://bitbucket.org/kencochrane/django-clickstream
+
+Installation
+------------
+
+Use pip to fetch the code::
+
+    pip install django-clickstream
+    
+Make sure that that sessions are activated:: 
+    
+Add `clickstream` to your INSTALLED_APPS::
+
+    INSTALLED_APPS = (
+        ...
+        'clickstream',
+    )
+
+Custom Settings
+===============
+Add the following properties to your settings file if you want to override the default settings.
+
+# CLICKSTREAM_IGNORE_PATHS
+# Default = ()
+# Takes a list of regular expressions for paths that you want to ignore
+# if it is picked up by these clicks won't be tracked.::
+
+    CLICKSTREAM_IGNORE_PATHS = ('^/private/',
+                            '^/dont-track-me/',
+                            'super-secret.txt',
+                            )
+
+# CLICKSTREAM_IGNORE_ANONYMOUS
+# Default = False
+# If you only want to track people that are logged in, change to True::
+
+    CLICKSTREAM_IGNORE_ANONYMOUS = False
+
+#CLICKSTREAM_IGNORE_IP
+# Default = ()
+# A list of IP's that you don't want to track::
+
+    CLICKSTREAM_IGNORE_IP = ('127.0.0.1', '10.10.10.10, '8.8.8.8')
+
+Middleware 
+==========
+Add 'clickstream.middleware.ClickStreamMiddleware' to your MIDDLEWARE_CLASSES settings 
+it needs to be after 'django.contrib.sessions.middleware.SessionMiddleware' in the list.
+
+
+Now load up the tables in your database::
+
+    python manage.py syncdb
+    
+Now run migrations::
+
+    python manage.py migrate
+
+        
+References
+----------
+        
+.. toctree::
+    :maxdepth: 2
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+

File docs/make.bat

+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+	set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html       to make standalone HTML files
+	echo.  dirhtml    to make HTML files named index.html in directories
+	echo.  singlehtml to make a single large HTML file
+	echo.  pickle     to make pickle files
+	echo.  json       to make JSON files
+	echo.  htmlhelp   to make HTML files and a HTML help project
+	echo.  qthelp     to make HTML files and a qthelp project
+	echo.  devhelp    to make HTML files and a Devhelp project
+	echo.  epub       to make an epub
+	echo.  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  text       to make text files
+	echo.  man        to make manual pages
+	echo.  changes    to make an overview over all changed/added/deprecated items
+	echo.  linkcheck  to check all external links for integrity
+	echo.  doctest    to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "singlehtml" (
+	%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\django-visitor.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\django-visitor.ghc
+	goto end
+)
+
+if "%1" == "devhelp" (
+	%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+	echo.
+	echo.Build finished.
+	goto end
+)
+
+if "%1" == "epub" (
+	%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+	echo.
+	echo.Build finished. The epub file is in %BUILDDIR%/epub.
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "text" (
+	%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+	echo.
+	echo.Build finished. The text files are in %BUILDDIR%/text.
+	goto end
+)
+
+if "%1" == "man" (
+	%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+	echo.
+	echo.Build finished. The manual pages are in %BUILDDIR%/man.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end
+from distutils.core import setup
+
+setup(
+    name='django-clickstream',
+    version='0.1',
+    description='Tracks your visitors as they click through your site',
+    maintainer='Ken Cochrane',
+    maintainer_email='KenCochrane@gmail.com',
+    url='https://bitbucket.org/kencochrane/django-clickstream/',
+    classifiers=[
+        'Programming Language :: Python',
+        'Framework :: Django',
+    ],
+    packages=['clickstream',],
+    long_description=open('README').read(),
+)
+