============================== Installation and configuration ============================== Integration of your analytics service is very simple. There are four steps: installing the package, adding it to the list of installed Django applications, adding the template tags to your base template, and configuring the services you use in the project settings. #. `Installing the Python package`_ #. `Installing the Django application`_ #. `Adding the template tags to the base template`_ #. `Enabling the services`_ .. _installing-the-package: Installing the Python package ============================= To install django-analytical the ``analytical`` package must be added to the Python path. You can install it directly from PyPI using ``easy_install``: .. code-block:: bash $ easy_install django-analytical You can also install directly from source. Download either the latest stable version from PyPI_ or any release from GitHub_, or use Git to get the development code: .. code-block:: bash $ git clone https://github.com/jazzband/django-analytical.git .. _PyPI: https://pypi.org/project/django-analytical/ .. _GitHub: http://github.com/jazzband/django-analytical Then install the package by running the setup script: .. code-block:: bash $ cd django-analytical $ python setup.py install .. _installing-the-application: Installing the Django application ================================= After you installed django-analytical, add the ``analytical`` Django application to the list of installed applications in the ``settings.py`` file of your project: .. code-block:: python INSTALLED_APPS = [ ... 'analytical', ... ] .. _adding-the-template-tags: Adding the template tags to the base template ============================================= 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 base template should look like this: .. code-block:: django {% load analytical %}
{% analytical_head_top %} ... {% analytical_head_bottom %} {% analytical_body_top %} ... {% analytical_body_bottom %} 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. .. _enabling-services: Enabling the services ===================== Without configuration, the template tags all render the empty string. Services are configured in the project ``settings.py`` file. The settings required to enable each service are listed here: * :doc:`Chartbeat