This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/static/lib/angulartics-mixpanel.js

30 lines
919 B
JavaScript
Raw Normal View History

2013-10-03 19:46:22 +00:00
/**
* @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);