mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
Added explicit python code blocks in the docs
This commit is contained in:
parent
b505558c8c
commit
938f1f2a63
1 changed files with 4 additions and 0 deletions
|
|
@ -133,6 +133,8 @@ variable must be set to a dictionary where the keys are the dimension names
|
|||
and the values are the dimension values. You can set the context variable in your
|
||||
view when you render a template containing the tracking code::
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
context = RequestContext({
|
||||
'google_analytics_custom_dimensions': {
|
||||
'gender': 'female',
|
||||
|
|
@ -151,6 +153,8 @@ sending user properties to Google Analytics automatically.
|
|||
You may want to set custom dimensions in a context processor that you add
|
||||
to the :data:`TEMPLATE_CONTEXT_PROCESSORS` list in :file:`settings.py`::
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
def google_analytics_segment_language(request):
|
||||
try:
|
||||
return {'google_analytics_custom_dimensions': {'language': request.LANGUAGE_CODE}}
|
||||
|
|
|
|||
Loading…
Reference in a new issue