twidi  committed 5c49a60

In the "show_tracker" templatetag, return a RequestContext, not only a simple context, to provide some other context var, added for exemple in the satchmo_context signal (for example, a "is_production" variable set to True only on production, usefull for analytics)

  • Participants
  • Parent commits 4630e4e
  • Branches default

Comments (0)

Files changed (1)

File satchmo/apps/satchmo_store/shop/templatetags/

-from django.template import Library
+from django.template import Library, RequestContext
 from django.conf import settings
 from import Contact
 from livesettings import config_value
 register = Library()
-def show_tracker(secure=False):
+def show_tracker(context, secure=False):
     Output the google tracker code.
-    return({"GOOGLE_CODE": config_value('GOOGLE', 'ANALYTICS_CODE'),
-            "secure" : secure})
+    return RequestContext(context['request'],
+        {"GOOGLE_CODE": config_value('GOOGLE', 'ANALYTICS_CODE'), "secure" : secure})
+register.inclusion_tag("shop/google-analytics/tracker.html", takes_context=True)(show_tracker)
 def show_receipt(context):