Last active
August 29, 2015 14:09
-
-
Save acreeger/53b005fa8ad26bcbed8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license Angulartics v0.17.0 | |
* (c) 2013 Luis Farzati http://luisfarzati.github.io/angulartics | |
* License: MIT | |
*/ | |
(function(angular) { | |
'use strict'; | |
/** | |
* @ngdoc overview | |
* @name angulartics.segment.io | |
* Enables analytics support for Segment.io (http://segment.io) | |
*/ | |
angular.module('angulartics.segment.io', ['angulartics']) | |
.config(['$analyticsProvider','$injector', function ($analyticsProvider, $injector) { | |
$analyticsProvider.registerPageTrack(function (path) { | |
$injector.invoke(['$location',function($location) { | |
try { | |
analytics.page({ | |
path: path, | |
url: $location.absUrl() | |
}); | |
} catch (e) { | |
if (!(e instanceof ReferenceError)) { | |
throw e; | |
} | |
} | |
}]); | |
}); | |
$analyticsProvider.registerEventTrack(function (action, properties) { | |
try { | |
analytics.track(action, properties); | |
} catch (e) { | |
if (!(e instanceof ReferenceError)) { | |
throw e; | |
} | |
} | |
}); | |
}]); | |
})(angular); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment