2011-01-24 23:13:44 +00:00
|
|
|
==============================
|
|
|
|
|
Installation and configuration
|
|
|
|
|
==============================
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
Integration of your analytics service is very simple. There are four
|
|
|
|
|
steps: installing the package, adding it to the list of installed Django
|
2011-01-28 17:01:09 +00:00
|
|
|
applications, adding the template tags to your base template, and
|
|
|
|
|
configuring the services you use in the project settings.
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
#. `Installing the Python package`_
|
|
|
|
|
#. `Installing the Django application`_
|
|
|
|
|
#. `Adding the template tags to the base template`_
|
2011-01-29 07:04:51 +00:00
|
|
|
#. `Enabling the services`_
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
|
2011-01-28 17:01:09 +00:00
|
|
|
.. _installing-the-package:
|
|
|
|
|
|
2011-01-21 01:01:40 +00:00
|
|
|
Installing the Python package
|
2011-01-24 23:13:44 +00:00
|
|
|
=============================
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
To install django-analytical the ``analytical`` package must be added to
|
|
|
|
|
the Python path. You can install it directly from PyPI using
|
2016-05-18 22:14:08 +00:00
|
|
|
``easy_install``:
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
|
|
$ easy_install django-analytical
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
You can also install directly from source. Download either the latest
|
2011-01-21 01:01:40 +00:00
|
|
|
stable version from PyPI_ or any release from GitHub_, or use Git to
|
2016-05-18 22:14:08 +00:00
|
|
|
get the development code:
|
|
|
|
|
|
|
|
|
|
.. code-block:: bash
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2018-11-28 20:36:23 +00:00
|
|
|
$ git clone https://github.com/jazzband/django-analytical.git
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
.. _PyPI: http://pypi.python.org/pypi/django-analytical/
|
2018-11-28 20:36:23 +00:00
|
|
|
.. _GitHub: http://github.com/jazzband/django-analytical
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
Then install the package by running the setup script:
|
|
|
|
|
|
2016-05-25 08:43:57 +00:00
|
|
|
.. code-block:: bash
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
$ cd django-analytical
|
|
|
|
|
$ python setup.py install
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
|
2011-01-28 17:01:09 +00:00
|
|
|
.. _installing-the-application:
|
|
|
|
|
|
2011-01-21 01:01:40 +00:00
|
|
|
Installing the Django application
|
2011-01-24 23:13:44 +00:00
|
|
|
=================================
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2011-01-28 17:01:09 +00:00
|
|
|
After you installed django-analytical, add the ``analytical`` Django
|
2011-01-21 01:01:40 +00:00
|
|
|
application to the list of installed applications in the ``settings.py``
|
2016-05-18 22:14:08 +00:00
|
|
|
file of your project:
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
INSTALLED_APPS = [
|
|
|
|
|
...
|
|
|
|
|
'analytical',
|
|
|
|
|
...
|
|
|
|
|
]
|
2011-01-21 01:01:40 +00:00
|
|
|
|
|
|
|
|
|
2011-01-28 17:01:09 +00:00
|
|
|
.. _adding-the-template-tags:
|
|
|
|
|
|
2011-01-21 01:01:40 +00:00
|
|
|
Adding the template tags to the base template
|
2011-01-24 23:13:44 +00:00
|
|
|
=============================================
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2011-01-28 17:01:09 +00:00
|
|
|
Because every analytics service uses own specific Javascript code that
|
|
|
|
|
should be added to the top or bottom of either the head or body of the
|
|
|
|
|
HTML page, django-analytical provides four general-purpose template tags
|
|
|
|
|
that will render the code needed for the services you are using. Your
|
2016-05-18 22:14:08 +00:00
|
|
|
base template should look like this:
|
|
|
|
|
|
2017-01-29 20:55:27 +00:00
|
|
|
.. code-block:: django
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2017-01-29 20:55:27 +00:00
|
|
|
{% load analytical %}
|
|
|
|
|
<!DOCTYPE ... >
|
|
|
|
|
<html>
|
|
|
|
|
<head>
|
|
|
|
|
{% analytical_head_top %}
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2017-01-29 20:55:27 +00:00
|
|
|
...
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2017-01-29 20:55:27 +00:00
|
|
|
{% analytical_head_bottom %}
|
|
|
|
|
</head>
|
|
|
|
|
<body>
|
|
|
|
|
{% analytical_body_top %}
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2017-01-29 20:55:27 +00:00
|
|
|
...
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2017-01-29 20:55:27 +00:00
|
|
|
{% analytical_body_bottom %}
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2011-01-29 07:04:51 +00:00
|
|
|
Instead of using the generic tags, you can also just use tags specific
|
|
|
|
|
for the analytics service(s) you are using. See :ref:`services` for
|
|
|
|
|
documentation on using individual services.
|
2011-01-28 17:01:09 +00:00
|
|
|
|
|
|
|
|
|
2011-01-29 07:04:51 +00:00
|
|
|
.. _enabling-services:
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2011-01-29 07:04:51 +00:00
|
|
|
Enabling the services
|
|
|
|
|
=====================
|
2011-01-21 01:01:40 +00:00
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
Without configuration, the template tags all render the empty string.
|
2011-01-29 07:04:51 +00:00
|
|
|
Services are configured in the project ``settings.py`` file. The
|
|
|
|
|
settings required to enable each service are listed here:
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2011-01-25 00:13:19 +00:00
|
|
|
* :doc:`Chartbeat <services/chartbeat>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
CHARTBEAT_USER_ID = '12345'
|
2011-01-25 00:13:19 +00:00
|
|
|
|
2012-12-05 07:22:17 +00:00
|
|
|
* :doc:`Clickmap <services/clickmap>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
CLICKMAP_TRACKER_CODE = '12345678....912'
|
2012-12-05 07:22:17 +00:00
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
* :doc:`Clicky <services/clicky>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
CLICKY_SITE_ID = '12345678'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
|
|
|
|
* :doc:`Crazy Egg <services/crazy_egg>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
CRAZY_EGG_ACCOUNT_NUMBER = '12345678'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2017-10-17 14:46:14 +00:00
|
|
|
* :doc:`Facebook Pixel <services/facebook_pixel>`::
|
|
|
|
|
|
|
|
|
|
FACEBOOK_PIXEL_ID = '1234567890'
|
|
|
|
|
|
2012-02-24 23:14:17 +00:00
|
|
|
* :doc:`Gaug.es <services/gauges>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
GAUGES_SITE_ID = '0123456789abcdef0123456789abcdef'
|
2012-02-24 23:14:17 +00:00
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
* :doc:`Google Analytics <services/google_analytics>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
GOOGLE_ANALYTICS_PROPERTY_ID = 'UA-1234567-8'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2011-01-29 07:04:51 +00:00
|
|
|
* :doc:`HubSpot <services/hubspot>`::
|
|
|
|
|
|
|
|
|
|
HUBSPOT_PORTAL_ID = '1234'
|
|
|
|
|
HUBSPOT_DOMAIN = 'somedomain.web101.hubspot.com'
|
|
|
|
|
|
2014-04-25 17:46:30 +00:00
|
|
|
* :doc:`Intercom <services/intercom>`::
|
|
|
|
|
|
|
|
|
|
INTERCOM_APP_ID = '0123456789abcdef0123456789abcdef01234567'
|
|
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
* :doc:`KISSinsights <services/kiss_insights>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
KISS_INSIGHTS_ACCOUNT_NUMBER = '12345'
|
|
|
|
|
KISS_INSIGHTS_SITE_CODE = 'abc'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
|
|
|
|
* :doc:`KISSmetrics <services/kiss_metrics>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
KISS_METRICS_API_KEY = '0123456789abcdef0123456789abcdef01234567'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2019-04-06 21:55:12 +00:00
|
|
|
* :doc:`Matomo (formerly Piwik) <services/matomo>`::
|
|
|
|
|
|
|
|
|
|
MATOMO_DOMAIN_PATH = 'your.matomo.server/optional/path'
|
|
|
|
|
MATOMO_SITE_ID = '123'
|
|
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
* :doc:`Mixpanel <services/mixpanel>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
MIXPANEL_API_TOKEN = '0123456789abcdef0123456789abcdef'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2011-03-15 11:58:52 +00:00
|
|
|
* :doc:`Olark <services/olark>`::
|
|
|
|
|
|
|
|
|
|
OLARK_SITE_ID = '1234-567-89-0123'
|
|
|
|
|
|
2011-01-24 23:13:44 +00:00
|
|
|
* :doc:`Optimizely <services/optimizely>`::
|
|
|
|
|
|
2016-05-18 22:14:08 +00:00
|
|
|
OPTIMIZELY_ACCOUNT_NUMBER = '1234567'
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2011-02-11 13:59:56 +00:00
|
|
|
* :doc:`Performable <services/performable>`::
|
|
|
|
|
|
|
|
|
|
PERFORMABLE_API_KEY = '123abc'
|
|
|
|
|
|
2019-04-06 21:55:12 +00:00
|
|
|
* :doc:`Piwik (deprecated, see Matomo) <services/piwik>`::
|
2014-07-04 19:31:46 +00:00
|
|
|
|
|
|
|
|
PIWIK_DOMAIN_PATH = 'your.piwik.server/optional/path'
|
|
|
|
|
PIWIK_SITE_ID = '123'
|
|
|
|
|
|
2016-05-25 22:47:04 +00:00
|
|
|
* :doc:`Rating\@Mail.ru <services/rating_mailru>`::
|
2016-04-24 09:15:36 +00:00
|
|
|
|
|
|
|
|
RATING_MAILRU_COUNTER_ID = '1234567'
|
|
|
|
|
|
2011-03-15 15:45:14 +00:00
|
|
|
* :doc:`Woopra <services/woopra>`::
|
|
|
|
|
|
|
|
|
|
WOOPRA_DOMAIN = 'abcde.com'
|
|
|
|
|
|
2016-04-03 09:12:19 +00:00
|
|
|
* :doc:`Yandex.Metrica <services/yandex_metrica>`::
|
|
|
|
|
|
|
|
|
|
YANDEX_METRICA_COUNTER_ID = '12345678'
|
|
|
|
|
|
2011-01-29 07:04:51 +00:00
|
|
|
----
|
2011-01-24 23:13:44 +00:00
|
|
|
|
2012-08-13 10:30:47 +00:00
|
|
|
The django-analytical application is now set-up to track visitors. For
|
2012-10-18 07:39:31 +00:00
|
|
|
information about identifying users, further configuration and
|
|
|
|
|
customization, see :doc:`features`.
|