Fix up docs style

This commit is contained in:
Joost Cassee 2015-03-09 20:38:48 +01:00
parent 54d922496d
commit c5c886d5bf
2 changed files with 24 additions and 10 deletions

View file

@ -109,17 +109,29 @@ Just remember that if you set the same context variable in the
:class:`~django.template.context.RequestContext` constructor and in a
context processor, the latter clobbers the former.
Mixpanel can also receive properties for your identified user, using `mixpanel.people.set <https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.people.set>`_. If want to send extra properties, just set a dictionary instead of a string in the ``mixpanel_indentity`` context variable. The key ``id`` or ``username`` will be used as the user unique id, and any other key-value pair will be passed as *people properties*. For example::
Mixpanel can also receive properties for your identified user, using
`mixpanel.people.set`_. If want to send extra properties, just set a
dictionary instead of a string in the ``mixpanel_identity`` context
variable. The key ``id`` or ``username`` will be used as the user unique
id, and any other key-value pair will be passed as *people properties*.
For example::
def identify(request):
try:
return {'mixpanel_identity': {'id': request.user.id,
'last_login': str(request.user.last_login),
'date_joined': str(request.user.date_joined)}
return {
'mixpanel_identity': {
'id': request.user.id,
'last_login': str(request.user.last_login),
'date_joined': str(request.user.date_joined),
}
}
except AttributeError:
return {}
.. _`mixpanel.people.set`: https://mixpanel.com/help/reference/javascript-full-api-reference#mixpanel.people.set
.. mixpanel-events:
Tracking events

View file

@ -175,20 +175,20 @@ Identifying users
-----------------
If your websites identifies visitors, you can pass this information on
to Uservoice. By default, the
name and email of an authenticated user is passed to Uservoice automatically. See
:ref:`identifying-visitors`.
to Uservoice. By default, the name and email of an authenticated user
is passed to Uservoice automatically. See :ref:`identifying-visitors`.
You can also send the visitor identity yourself by adding either the
``uservoice_identity`` or the ``analytical_identity`` variable to
the template context [1]_. This should be a dictionary with the desired user traits as its keys. Check the `documentation <https://developer.uservoice.com/docs/widgets/identify/>`_ to see valid traits. For example::
the template context. (If both are set, the former takes precedence.)
This should be a dictionary with the desired user traits as its keys.
Check the `documentation on identifying users`_ to see valid traits.
For example::
context = RequestContext({'uservoice_identity': {'email': user_email,
'name': username }})
return some_template.render(context)
.. [1]: Remember that if both variables are set, the former takes precedence.
If you can derive the identity from the HTTP request, you can also use
a context processor that you add to the :data:`TEMPLATE_CONTEXT_PROCESSORS` list in :file:`settings.py`::
@ -210,6 +210,8 @@ a context processor that you add to the :data:`TEMPLATE_CONTEXT_PROCESSORS` list
except AttributeError:
return {}
.. _`documentation on identifying users`: https://developer.uservoice.com/docs/widgets/identify/
----
Thanks go to UserVoice for their support with the development of this