mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
add more information about overriding identity to documentation
This commit is contained in:
parent
7e28ee31f1
commit
96f1ba98b1
2 changed files with 36 additions and 0 deletions
|
|
@ -68,3 +68,23 @@ and is enabled by default. To disable:
|
||||||
Alternatively, add one of the variables to the context yourself
|
Alternatively, add one of the variables to the context yourself
|
||||||
when you render the template.
|
when you render the template.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Changing the identity
|
||||||
|
*********************
|
||||||
|
|
||||||
|
If you want to change identity of the user, that different providers are
|
||||||
|
sending, you can do it by setting the `analyitcal_identity` context variable::
|
||||||
|
|
||||||
|
context = RequestContext({'analytical_identity': user.uuid})
|
||||||
|
return some_template.render(context)
|
||||||
|
|
||||||
|
or in the template::
|
||||||
|
|
||||||
|
{% with analytical_identity=request.user.uuid|default:None %}
|
||||||
|
{% analytical_head_top %}
|
||||||
|
{% endwith %}
|
||||||
|
|
||||||
|
If you want to change the identity only for specific provider, use the
|
||||||
|
`*_identity` context variable, where `*` is prefix specified on the provider
|
||||||
|
page.
|
||||||
|
|
|
||||||
|
|
@ -95,3 +95,19 @@ Identifying authenticated users
|
||||||
|
|
||||||
The username of an authenticated user is passed to Google Analytics
|
The username of an authenticated user is passed to Google Analytics
|
||||||
automatically as the `user_id`. See :ref:`identifying-visitors`.
|
automatically as the `user_id`. See :ref:`identifying-visitors`.
|
||||||
|
|
||||||
|
According to `Google Analytics conditions <https://developers.google.com/analytics/solutions/crm-integration#user_id>`_
|
||||||
|
you should avoid sending Personally Identifiable Information.
|
||||||
|
Using `username` as `user_id` might not be the best option.
|
||||||
|
To avoid that, you can change the identity
|
||||||
|
by setting `google_analytics_gtag_identity` (or `analytical_identity` to
|
||||||
|
affect all providers) context variable::
|
||||||
|
|
||||||
|
context = RequestContext({'google_analytics_gtag_identity': user.uuid})
|
||||||
|
return some_template.render(context)
|
||||||
|
|
||||||
|
or in the template::
|
||||||
|
|
||||||
|
{% with google_analytics_gtag_identity=request.user.uuid|default:None %}
|
||||||
|
{% analytical_head_top %}
|
||||||
|
{% endwith %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue