mirror of
https://github.com/jazzband/django-analytical.git
synced 2026-03-16 22:20:25 +00:00
Fix missing protocol in script url, #108
This commit is contained in:
parent
11e0372017
commit
736472587d
2 changed files with 9 additions and 1 deletions
|
|
@ -27,7 +27,7 @@ SETUP_CODE = """
|
|||
(function(i,s,o,g,r,a,m){{i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){{
|
||||
(i[r].q=i[r].q||[]).push(arguments)}},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
}})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||
}})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||
|
||||
ga('create', '{property_id}', 'auto', {create_fields});
|
||||
{display_features}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,19 @@ class GoogleAnalyticsTagTestCase(TagTestCase):
|
|||
|
||||
def test_tag(self):
|
||||
r = self.render_tag('google_analytics_js', 'google_analytics_js')
|
||||
self.assertTrue("""(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');""" in r, r)
|
||||
self.assertTrue("ga('create', 'UA-123456-7', 'auto', {});" in r, r)
|
||||
self.assertTrue("ga('send', 'pageview');" in r, r)
|
||||
|
||||
def test_node(self):
|
||||
r = GoogleAnalyticsJsNode().render(Context())
|
||||
self.assertTrue("""(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');""" in r, r)
|
||||
self.assertTrue("ga('create', 'UA-123456-7', 'auto', {});" in r, r)
|
||||
self.assertTrue("ga('send', 'pageview');" in r, r)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue