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
2013-10-03 15:46:22 -04:00

30 lines
No EOL
919 B
JavaScript
Executable file

/**
* @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);