Ghost/core/server/analytics-events.js
Hannah Wolfe 79ca6c575c Cleared out old unused events
no issue

- Because of 9248 we send too many events and this is not reliable
- Remove everything except the well understood published events
2017-12-13 09:08:25 +00:00

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}));
});
});
};