mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Removed unneeded analytics for model events
refs https://linear.app/tryghost/issue/BIZ-6/[wip]-update-segment-events - Removed model events to listen to: `post.published`, `page.published`, and `theme.uploaded` in segment service, as we're not actively using those. - Updated tests to reflect the changes (from 4 events to 1 model event)
This commit is contained in:
parent
b30558c77c
commit
e4b9305e2a
2 changed files with 4 additions and 37 deletions
|
@ -50,21 +50,6 @@ module.exports = class ModelEventsAnalytics {
|
|||
* @type {Array<{event: string, name: string, data?: object}>}
|
||||
*/
|
||||
#toTrack = [
|
||||
{
|
||||
event: 'post.published',
|
||||
name: 'Post Published'
|
||||
},
|
||||
{
|
||||
event: 'page.published',
|
||||
name: 'Page Published'
|
||||
},
|
||||
{
|
||||
event: 'theme.uploaded',
|
||||
name: 'Theme Uploaded',
|
||||
// {keyOnSuppliedEventData: keyOnTrackedEventData}
|
||||
// - used to extract specific properties from event data and give them meaningful names
|
||||
data: {name: 'name'}
|
||||
},
|
||||
{
|
||||
event: 'integration.added',
|
||||
name: 'Custom Integration Added'
|
||||
|
|
|
@ -53,7 +53,8 @@ describe('ModelEventsAnalytics', function () {
|
|||
|
||||
modelEventsAnalytics.subscribeToEvents();
|
||||
|
||||
assert(eventStub.callCount === 4);
|
||||
// as per #toTrack Array
|
||||
assert(eventStub.callCount === 1);
|
||||
assert(loggingStub.callCount === 0);
|
||||
});
|
||||
|
||||
|
@ -83,27 +84,8 @@ describe('ModelEventsAnalytics', function () {
|
|||
events.emit('page.published');
|
||||
events.emit('integration.added');
|
||||
|
||||
assert(analyticsStub.callCount === 4);
|
||||
assert(analyticsStub.callCount === 1);
|
||||
assert(analyticsStub.getCall(0).calledWithExactly({
|
||||
userId: '1234',
|
||||
properties: {email: 'john@test.com'},
|
||||
event: 'Pro: Theme Uploaded',
|
||||
name: 'Custom Super Theme'
|
||||
}));
|
||||
|
||||
assert(analyticsStub.getCall(1).calledWithExactly({
|
||||
userId: '1234',
|
||||
properties: {email: 'john@test.com'},
|
||||
event: 'Pro: Post Published'
|
||||
}));
|
||||
|
||||
assert(analyticsStub.getCall(2).calledWithExactly({
|
||||
userId: '1234',
|
||||
properties: {email: 'john@test.com'},
|
||||
event: 'Pro: Page Published'
|
||||
}));
|
||||
|
||||
assert(analyticsStub.getCall(3).calledWithExactly({
|
||||
userId: '1234',
|
||||
properties: {email: 'john@test.com'},
|
||||
event: 'Pro: Custom Integration Added'
|
||||
|
@ -112,7 +94,7 @@ describe('ModelEventsAnalytics', function () {
|
|||
events.emit('post.unpublished');
|
||||
|
||||
// Analytics should not be called again
|
||||
assert(analyticsStub.callCount === 4);
|
||||
assert(analyticsStub.callCount === 1);
|
||||
assert(loggingStub.callCount === 0);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue