Add mix panel analytics to Quay

This commit is contained in:
Joseph Schorr 2013-10-03 15:46:22 -04:00
parent df36a0b913
commit be1582ba29
4 changed files with 196 additions and 13 deletions

30
static/lib/angulartics-mixpanel.js vendored Executable file
View file

@ -0,0 +1,30 @@
/**
* @license Angulartics v0.8.5
* (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics
* Contributed by http://github.com/L42y
* License: MIT
*/
(function(angular) {
'use strict';
/**
* @ngdoc overview
* @name angulartics.mixpanel
* Enables analytics support for Mixpanel (http://mixpanel.com)
*/
angular.module('angulartics.mixpanel', ['angulartics'])
.config(['$analyticsProvider', function ($analyticsProvider) {
angulartics.waitForVendorApi('mixpanel', 500, function (mixpanel) {
$analyticsProvider.registerPageTrack(function (path) {
if (path.indexOf('http') == 0) { return; }
window.mixpanel.track('page_view', { 'url' : path });
});
});
angulartics.waitForVendorApi('mixpanel', 500, function (mixpanel) {
$analyticsProvider.registerEventTrack(function (action, properties) {
window.mixpanel.track(action, properties);
});
});
}]);
})(angular);