luisfarzati/angulartics — pull request #170 by quentin- (2014-07-24 23:23:52+00:00)
Title: callback passed around to plugin

This enable a callbacks to be passed to ```eventTrack``` method.
This solves: https://github.com/luisfarzati/angulartics/pull/167 in a cleaner way.

Registering the callback:

```javascript
$analytics.eventTrack('ui_view_click_google' , null, function() {
$windows.location = 'http://www.google.com';
});
```

Handling the callback in a custom plugin:

```javascript
(function(angular) {
'use strict';

var module = angular.module('app.angulartics', [
'angulartics'
]);

module.config(function($analyticsProvider, $api) {

var send = function(name, data, callback) {
$api.events.create({
name: name
data: data
}).then(callback)
};

$analyticsProvider.registerEventTrack(send);

})

})(angular);
```