Add Google Tag Manager support to Quay

This commit is contained in:
Joseph Schorr 2016-04-06 16:15:26 -04:00
parent f28cee653c
commit 891f7d9213
2 changed files with 12 additions and 14 deletions

View file

@ -206,7 +206,7 @@ def render_page_template(name, route_data=None, **kwargs):
scope_set=json.dumps(scopes.app_scopes(app.config)), scope_set=json.dumps(scopes.app_scopes(app.config)),
vuln_priority_set=json.dumps(PRIORITY_LEVELS), vuln_priority_set=json.dumps(PRIORITY_LEVELS),
mixpanel_key=app.config.get('MIXPANEL_KEY', ''), mixpanel_key=app.config.get('MIXPANEL_KEY', ''),
google_analytics_key=app.config.get('GOOGLE_ANALYTICS_KEY', ''), google_tagmanager_key=app.config.get('GOOGLE_TAGMANAGER_KEY', ''),
sentry_public_dsn=app.config.get('SENTRY_PUBLIC_DSN', ''), sentry_public_dsn=app.config.get('SENTRY_PUBLIC_DSN', ''),
is_debug=str(app.config.get('DEBUGGING', False)).lower(), is_debug=str(app.config.get('DEBUGGING', False)).lower(),
show_chat=features.OLARK_CHAT, show_chat=features.OLARK_CHAT,

View file

@ -72,19 +72,6 @@ b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug }} });</script><!-- end Mixpanel --> mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug }} });</script><!-- end Mixpanel -->
{% endif %} {% endif %}
{% if google_analytics_key %}
<script>
(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');
ga('create', '{{ google_analytics_key }}', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
</script>
{% endif %}
</head> </head>
<body ng-class="pageClass + ' ' + (user.anonymous ? 'anon' : 'signedin')" class="co-img-bg-network"> <body ng-class="pageClass + ' ' + (user.anonymous ? 'anon' : 'signedin')" class="co-img-bg-network">
<div id="co-l-footer-wrapper"> <div id="co-l-footer-wrapper">
@ -268,6 +255,17 @@ mixpanel.init("{{ mixpanel_key }}", { track_pageview : false, debug: {{ is_debug
<!-- end olark code --> <!-- end olark code -->
{% endif %} {% endif %}
{% if google_tagmanager_key %}
<!-- Google Tag Manager (hooked up to CrossDomain) -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id={{ google_tagmanager_key }}"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{ google_tagmanager_key }}');</script>
{% endif %}
<div class="angular-tour-ui" inline="false" tour="angular_tour_current"></div> <div class="angular-tour-ui" inline="false" tour="angular_tour_current"></div>
</body> </body>
</html> </html>