mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
15d9a77092
* moved `server/config` to `shared/config` * updated config import paths in server to use shared * updated config import paths in frontend to use shared * updated config import paths in test to use shared * updated config import paths in root to use shared * trigger regression tests * of course the rebase broke tests
36 lines
991 B
JavaScript
36 lines
991 B
JavaScript
const _ = require('lodash');
|
|
const Analytics = require('analytics-node');
|
|
const config = require('../shared/config');
|
|
const {events} = require('./lib/common');
|
|
|
|
module.exports.init = function () {
|
|
const analytics = new Analytics(config.get('segment:key'));
|
|
const trackDefaults = config.get('segment:trackDefaults') || {};
|
|
const prefix = config.get('segment:prefix') || '';
|
|
|
|
const 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) {
|
|
events.on(track.event, function () {
|
|
analytics.track(_.extend(trackDefaults, {event: prefix + track.name}));
|
|
});
|
|
});
|
|
};
|