Rename context var to 'kiss_metrics_properties'; add link to KISSmetrics docs.

This commit is contained in:
Paul Oswald 2011-09-19 10:03:10 +09:00
parent 56653912f1
commit ebfebef65d
3 changed files with 10 additions and 8 deletions

View file

@ -37,7 +37,7 @@ EVENT_CODE = "_kmq.push(['record', '%(name)s', %(properties)s]);"
PROPERTY_CODE = "_kmq.push(['set', %(properties)s]);"
EVENT_CONTEXT_KEY = 'kiss_metrics_event'
PROPERTY_CONTEXT_KEY = 'kiss_metrics_property'
PROPERTY_CONTEXT_KEY = 'kiss_metrics_properties'
register = Library()

View file

@ -54,7 +54,7 @@ class KissMetricsTagTestCase(TagTestCase):
'{"prop1": "val1", "prop2": "val2"}]);' in r, r)
def test_property(self):
r = KissMetricsNode().render(Context({'kiss_metrics_property':
r = KissMetricsNode().render(Context({'kiss_metrics_properties':
{'prop1': 'val1', 'prop2': 'val2'}}))
self.assertTrue("_kmq.push(['set', "
'{"prop1": "val1", "prop2": "val2"}]);' in r, r)

View file

@ -122,9 +122,8 @@ For example::
})
return some_template.render(context)
The output script tag will then include the corresponding Javascript event:
_kmq.push(['record', 'Signed Up', {'Plan':'Pro', 'Amount':9.99}]);
The output script tag will then include the corresponding Javascript event as
documented in the `KISSmetrics record API`_ docs.
.. _kiss-metrics-properties:
@ -137,11 +136,14 @@ You may also set KISSmetrics properties without a corresponding event.
For example::
context = RequestContext({
'kiss_metrics_property': {'gender': 'Male'},
'kiss_metrics_properties': {'gender': 'Male'},
})
return some_template.render(context)
The output script tag will then include the corresponding Javascript event:
The output script tag will then include the corresponding properties as
documented in the `KISSmetrics set API`_ docs.
_kmq.push(['set', {'gender':'Male'}]);
.. _`KISSmetrics set API`: http://support.kissmetrics.com/apis/common-methods#record
.. _`KISSmetrics record API`: http://support.kissmetrics.com/apis/common-methods#set