From ebfebef65de8a393853c7c23f278a738dadd96ce Mon Sep 17 00:00:00 2001 From: Paul Oswald Date: Mon, 19 Sep 2011 10:03:10 +0900 Subject: [PATCH] Rename context var to 'kiss_metrics_properties'; add link to KISSmetrics docs. --- analytical/templatetags/kiss_metrics.py | 2 +- analytical/tests/test_tag_kiss_metrics.py | 2 +- docs/services/kiss_metrics.rst | 14 ++++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/analytical/templatetags/kiss_metrics.py b/analytical/templatetags/kiss_metrics.py index 059060f..40c1859 100644 --- a/analytical/templatetags/kiss_metrics.py +++ b/analytical/templatetags/kiss_metrics.py @@ -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() diff --git a/analytical/tests/test_tag_kiss_metrics.py b/analytical/tests/test_tag_kiss_metrics.py index 8ab4344..8fc7c59 100644 --- a/analytical/tests/test_tag_kiss_metrics.py +++ b/analytical/tests/test_tag_kiss_metrics.py @@ -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) diff --git a/docs/services/kiss_metrics.rst b/docs/services/kiss_metrics.rst index 46eedea..91932e5 100644 --- a/docs/services/kiss_metrics.rst +++ b/docs/services/kiss_metrics.rst @@ -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