# Rating@Mail.ru – traffic analysis

Rating@Mail.ru is an analytics tool like as google analytics.

## Installation

To start using the Rating@Mail.ru integration, you must have installed the django-analytical package and have added the `analytical` application to `INSTALLED_APPS` in your project `settings.py` file. See Installation and configuration for details.

Next you need to add the Rating@Mail.ru template tag to your templates. This step is only needed if you are not using the generic `analytical.*` tags. If you are, skip to Configuration.

The Rating@Mail.ru counter code is inserted into templates using a template tag. Load the `rating_mailru` template tag library and insert the `rating_mailru` tag. Because every page that you want to track must have the tag, it is useful to add it to your base template. Insert the tag at the bottom of the HTML head:

    {% load rating_mailru %}
    <html>
    <head>
    ...
    {% rating_mailru %}
    </head>
    ...

## Configuration

Before you can use the Rating@Mail.ru integration, you must first set your website counter ID.

### Setting the counter ID

Every website you track with Rating@Mail.ru gets its own counter ID, and the `rating_mailru` tag will include it in the rendered Javascript code. You can find the web counter ID on the overview page of your account. Set `RATING_MAILRU_COUNTER_ID` in the project `settings.py` file:

    RATING_MAILRU_COUNTER_ID = '1234567'

If you do not set a counter ID, the counter code will not be rendered.

### Internal IP addresses

Usually you do not want to track clicks from your development or internal IP addresses. By default, if the tags detect that the client comes from any address in the `RATING_MAILRU_INTERNAL_IPS` setting, the tracking code is commented out. It takes the value of `ANALYTICAL_INTERNAL_IPS` by default (which in turn is `INTERNAL_IPS` by default). See Identifying authenticated users for important information about detecting the visitor IP address.