Moved Segment analytics file into service

- this file is already in our "init"-style, so this commit simply moves
  the file into a service and fixes the import paths
This commit is contained in:
Daniel Lockyer 2023-02-27 17:23:11 +01:00
parent 1ecf77db48
commit 51a25769eb
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View File

@ -352,7 +352,7 @@ async function initServices({config}) {
// Initialize analytics events
if (config.get('segment:key')) {
require('./server/analytics-events').init();
require('./server/services/segment').init();
}
debug('End: initServices');

View File

@ -1,11 +1,12 @@
const _ = require('lodash');
const Analytics = require('analytics-node');
const config = require('../shared/config');
const logging = require('@tryghost/logging');
const sentry = require('../shared/sentry');
const config = require('../../../shared/config');
const sentry = require('../../../shared/sentry');
// Listens to model events to layer on analytics - also uses the "fake" theme.uploaded event from the theme API
const events = require('./lib/common/events');
const events = require('../../lib/common/events');
module.exports.init = function () {
const analytics = new Analytics(config.get('segment:key'));