79ca6c575c
no issue - Because of 9248 we send too many events and this is not reliable - Remove everything except the well understood published events
30 lines
807 B
JavaScript
30 lines
807 B
JavaScript
var _ = require('lodash'),
|
|
Analytics = require('analytics-node'),
|
|
config = require('./config'),
|
|
common = require('./lib/common'),
|
|
analytics;
|
|
|
|
module.exports.init = function () {
|
|
analytics = new Analytics(config.get('segment:key'));
|
|
var toTrack,
|
|
trackDefaults = config.get('segment:trackDefaults') || {},
|
|
prefix = config.get('segment:prefix') || '';
|
|
|
|
toTrack = [
|
|
{
|
|
event: 'post.published',
|
|
name: 'Blog Post Published'
|
|
},
|
|
{
|
|
event: 'page.published',
|
|
name: 'Blog Page Published'
|
|
}
|
|
];
|
|
|
|
_.each(toTrack, function (track) {
|
|
common.events.on(track.event, function () {
|
|
analytics.track(_.extend(trackDefaults, {event: prefix + track.name}));
|
|
});
|
|
});
|
|
};
|