From a7069014050987127f48f071408abd5b4dc6827a Mon Sep 17 00:00:00 2001 From: Ben Spoon Date: Tue, 16 Aug 2016 11:35:39 -0700 Subject: [PATCH] analytics: add google analytics --- endpoints/common.py | 1 + static/js/app.js | 6 +++++- templates/base.html | 13 +++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/endpoints/common.py b/endpoints/common.py index b79dca4ff..5de9c3ee8 100644 --- a/endpoints/common.py +++ b/endpoints/common.py @@ -209,6 +209,7 @@ def render_page_template(name, route_data=None, **kwargs): mixpanel_key=app.config.get('MIXPANEL_KEY', ''), munchkin_key=app.config.get('MUNCHKIN_KEY', ''), google_tagmanager_key=app.config.get('GOOGLE_TAGMANAGER_KEY', ''), + google_anaytics_key=app.config.get('GOOGLE_ANALYTICS_KEY', ''), sentry_public_dsn=app.config.get('SENTRY_PUBLIC_DSN', ''), is_debug=str(app.config.get('DEBUGGING', False)).lower(), show_chat=features.SUPPORT_CHAT, diff --git a/static/js/app.js b/static/js/app.js index 93e40066e..cec6da259 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -39,7 +39,7 @@ quayDependencies = ['ngRoute', 'chieffancypants.loadingBar', 'cfp.hotkeys', 'ang 'mgcrea.ngStrap', 'ngCookies', 'ngSanitize', 'angular-md5', 'pasvaz.bindonce', 'ansiToHtml', 'core-ui', 'core-config-setup', 'quayPages', 'infinite-scroll']; -if (window.__config && (window.__config.MIXPANEL_KEY || window.__config.MUNCHKIN_KEY)) { +if (window.__config && (window.__config.MIXPANEL_KEY || window.__config.MUNCHKIN_KEY || window.__config.GOOGLE_ANALYTICS_KEY)) { quayDependencies.push('angulartics'); } @@ -51,6 +51,10 @@ if (window.__config && window.__config.MUNCHKIN_KEY) { quayDependencies.push('angulartics.marketo'); } +if (window.__config && window.__config.GOOGLE_ANALYTICS_KEY) { + quayDependencies.push('angulartics.google.analytics'); +} + // Define the application. quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoadingBarProvider) { cfpLoadingBarProvider.includeSpinner = false; diff --git a/templates/base.html b/templates/base.html index b21d10141..9cbfd9bf0 100644 --- a/templates/base.html +++ b/templates/base.html @@ -71,6 +71,19 @@ {% endif %} + {% if google_analytics_key %} + + {% endif %} + {% if mixpanel_key %}