Added missing events for analytics

refs https://github.com/TryGhost/Team/issues/1054

In order to listen to events we must define them! This adds the missing
events that we need to listen to for member analytics.
This commit is contained in:
Fabien O'Carroll 2021-09-21 18:27:56 +02:00
parent 41bdd38237
commit 9fca7ce8f3
5 changed files with 111 additions and 1 deletions

View File

@ -1,3 +1,7 @@
module.exports = {
MemberEntryViewEvent: require('./lib/MemberEntryViewEvent')
MemberEntryViewEvent: require('./lib/MemberEntryViewEvent'),
MemberUnsubscribeEvent: require('./lib/MemberUnsubscribeEvent'),
MemberSignupEvent: require('./lib/MemberSignupEvent'),
MemberPaidConverstionEvent: require('./lib/MemberPaidConversionEvent'),
MemberPaidCancellationEvent: require('./lib/MemberPaidCancellationEvent')
};

View File

@ -0,0 +1,27 @@
/**
* @typedef {object} MemberPaidCancellationEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} subscriptionId
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberPaidCancellationEvent {
/**
* @param {MemberPaidCancellationEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {MemberPaidCancellationEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new MemberPaidCancellationEvent(data, timestamp || new Date);
}
};

View File

@ -0,0 +1,27 @@
/**
* @typedef {object} MemberPaidConversionEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} subscriptionId
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberPaidConversionEvent {
/**
* @param {MemberPaidConversionEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {MemberPaidConversionEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new MemberPaidConversionEvent(data, timestamp || new Date);
}
};

View File

@ -0,0 +1,26 @@
/**
* @typedef {object} MemberSignupEventData
* @prop {string} memberId
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberSignupEvent {
/**
* @param {MemberSignupEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {MemberSignupEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new MemberSignupEvent(data, timestamp || new Date);
}
};

View File

@ -0,0 +1,26 @@
/**
* @typedef {object} MemberUnsubscribeEventData
* @prop {string} memberId
* @prop {string} memberStatus
* @prop {string} entryId
* @prop {string} sourceUrl
*/
module.exports = class MemberUnsubscribeEvent {
/**
* @param {MemberUnsubscribeEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {MemberUnsubscribeEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new MemberUnsubscribeEvent(data, timestamp || new Date);
}
};