diff options
author | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-06-15 11:22:53 -0700 |
---|---|---|
committer | Reed Garmsen <rgarmsen2295@gmail.com> | 2015-06-15 11:22:53 -0700 |
commit | 6883f691ef3b33ceee6bc525830675245aaf508a (patch) | |
tree | 4693838432e0c544944b137ab246fbcc4583d848 /web/templates | |
parent | c94883e0dfc0c7cbcf86a78f9134d1e3283a07cd (diff) | |
parent | 08e02c3dad4d2fa765b11ae58313b3f3e375e447 (diff) | |
download | chat-6883f691ef3b33ceee6bc525830675245aaf508a.tar.gz chat-6883f691ef3b33ceee6bc525830675245aaf508a.tar.bz2 chat-6883f691ef3b33ceee6bc525830675245aaf508a.zip |
Merge pull request #1 from mattermost/master
to me
Diffstat (limited to 'web/templates')
-rw-r--r-- | web/templates/head.html | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/web/templates/head.html b/web/templates/head.html index 5fd3ee104..5eb7a7333 100644 --- a/web/templates/head.html +++ b/web/templates/head.html @@ -36,6 +36,7 @@ window._LTracker = _LTracker; _LTracker.push({'logglyKey': config.LogglyWriteKey, 'sendConsoleErrors' : config.LogglyConsoleErrors }); } else { + window._LTracker = []; console.warn("config.js missing LogglyWriteKey, Loggly analytics is not reporting"); } </script> @@ -58,26 +59,34 @@ analytics.page(); }}(); } else { + analytics = {}; + analytics.page = function(){}; + analytics.track = function(){}; console.warn("config.js missing SegmentWriteKey, SegmentIO analytics is not tracking"); } </script> <!-- Snowplow starts plowing --> <script type="text/javascript"> - ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; - p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) - };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; - n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.4.2/sp.js","snowplow")); + if ('{{ .Props.AnalyticsUrl }}'.trim() !== '') { + ;(function(p,l,o,w,i,n,g){if(!p[i]){p.GlobalSnowplowNamespace=p.GlobalSnowplowNamespace||[]; + p.GlobalSnowplowNamespace.push(i);p[i]=function(){(p[i].q=p[i].q||[]).push(arguments) + };p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; + n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","//d1fc8wv8zag5ca.cloudfront.net/2.4.2/sp.js","snowplow")); - window.snowplow('newTracker', 'cf', '{{ .Props.AnalyticsUrl }}', { - appId: '{{ .SiteName }}' - }); + window.snowplow('newTracker', 'cf', '{{ .Props.AnalyticsUrl }}', { + appId: '{{ .SiteName }}' + }); - var user = window.UserStore.getCurrentUser(true); - if (user) { - window.snowplow('setUserId', user.id); - } + var user = window.UserStore.getCurrentUser(true); + if (user) { + window.snowplow('setUserId', user.id); + } - window.snowplow('trackPageView'); + window.snowplow('trackPageView'); + } else { + window.snowplow = function(){}; + console.warn("config.json missing AnalyticsUrl, Snowplow analytics is not tracking"); + } </script> <!-- Snowplow stops plowing --> </head> |