mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-01 05:50:35 +03:00
23215e7d74
no issue - There was no model event being sent yet when a new integration is being created - Added this event type to our analytics listener
38 lines
996 B
JavaScript
38 lines
996 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: 'Post Published'
|
|
},
|
|
{
|
|
event: 'page.published',
|
|
name: 'Page Published'
|
|
},
|
|
{
|
|
event: 'theme.uploaded',
|
|
name: 'Theme Uploaded'
|
|
},
|
|
{
|
|
event: 'integration.added',
|
|
name: 'Custom Integration Added'
|
|
}
|
|
];
|
|
|
|
_.each(toTrack, function (track) {
|
|
common.events.on(track.event, function () {
|
|
analytics.track(_.extend(trackDefaults, {event: prefix + track.name}));
|
|
});
|
|
});
|
|
};
|