Add Google Analytics
This commit is contained in:
parent
cc8e0e5ea5
commit
777cc45fcb
3 changed files with 47 additions and 1 deletions
|
@ -89,7 +89,7 @@ function getMarkedDown(string) {
|
|||
}
|
||||
|
||||
// Start the application code itself.
|
||||
quayApp = angular.module('quay', ['ngRoute', 'restangular', 'angularMoment', 'angulartics', 'angulartics.mixpanel', '$strap.directives', 'ngCookies'], function($provide) {
|
||||
quayApp = angular.module('quay', ['ngRoute', 'restangular', 'angularMoment', 'angulartics', 'angulartics.mixpanel', 'angulartics.google.analytics', '$strap.directives', 'ngCookies'], function($provide) {
|
||||
$provide.factory('CookieService', ['$cookies', '$cookieStore', function($cookies, $cookieStore) {
|
||||
var cookieService = {};
|
||||
cookieService.putPermanent = function(name, value) {
|
||||
|
|
32
static/lib/angulartics-google-analytics.js
vendored
Normal file
32
static/lib/angulartics-google-analytics.js
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* @license Angulartics v0.8.5
|
||||
* (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
|
||||
* Universal Analytics update contributed by http://github.com/willmcclellan
|
||||
* License: MIT
|
||||
*/
|
||||
(function(angular) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name angulartics.google.analytics
|
||||
* Enables analytics support for Google Analytics (http://google.com/analytics)
|
||||
*/
|
||||
angular.module('angulartics.google.analytics', ['angulartics'])
|
||||
.config(['$analyticsProvider', function ($analyticsProvider) {
|
||||
|
||||
// GA already supports buffered invocations so we don't need
|
||||
// to wrap these inside angulartics.waitForVendorApi
|
||||
|
||||
$analyticsProvider.registerPageTrack(function (path) {
|
||||
if (window._gaq) _gaq.push(['_trackPageview', path]);
|
||||
if (window.ga) ga('send', 'pageview', path);
|
||||
});
|
||||
|
||||
$analyticsProvider.registerEventTrack(function (action, properties) {
|
||||
if (window._gaq) _gaq.push(['_trackEvent', properties.category, action, properties.label, properties.value]);
|
||||
if (window.ga) ga('send', 'event', properties.category, action, properties.label, properties.value);
|
||||
});
|
||||
|
||||
}]);
|
||||
})(angular);
|
|
@ -47,6 +47,7 @@
|
|||
<script src="static/lib/angular-strap.min.js"></script>
|
||||
<script src="static/lib/angulartics.js"></script>
|
||||
<script src="static/lib/angulartics-mixpanel.js"></script>
|
||||
<script src="static/lib/angulartics-google-analytics.js"></script>
|
||||
|
||||
<script src="static/lib/angular-moment.min.js"></script>
|
||||
<script src="static/lib/angular-cookies.min.js"></script>
|
||||
|
@ -72,6 +73,19 @@ var isProd = document.location.hostname === 'quay.io';
|
|||
typeof d?c=b[d]=[]:d="mixpanel";c.people=c.people||[];c.toString=function(b){var a="mixpanel";"mixpanel"!==d&&(a+="."+d);b||(a+=" (stub)");return a};c.people.toString=function(){return c.toString(1)+".people (stub)"};i="disable track track_pageview track_links track_forms register register_once alias unregister identify name_tag set_config people.set people.set_once people.increment people.append people.track_charge people.clear_charges people.delete_user".split(" ");for(g=0;g<i.length;g++)f(c,i[g]);
|
||||
b._i.push([a,e,d])};b.__SV=1.2}})(document,window.mixpanel||[]);
|
||||
mixpanel.init(isProd ? "50ff2b2569faa3a51c8f5724922ffb7e" : "38014a0f27e7bdc3ff8cc7cc29c869f9", { track_pageview : false, debug: !isProd });</script><!-- end Mixpanel -->
|
||||
|
||||
<!-- start analytics --><script>
|
||||
var isProd = document.location.hostname === 'quay.io';
|
||||
|
||||
(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', isProd ? 'UA-34988886-5' : 'UA-34988886-4', 'quay.io');
|
||||
ga('send', 'pageview');
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div ng-class="!fixFooter ? 'wrapper' : ''">
|
||||
|
|
Reference in a new issue