This repository was archived by the owner on Apr 28, 2022. It is now read-only.
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
event.type comes through as "page" for track events #670
Open
Description
I'm not sure if this is expected behaviour, I'm trying to write an enrichment
plugin that fetches extra data for events before sending them off. It's working pretty well, but I need to differentiate between tracks and pages but both calls come through as event.type === 'page'
. Is this expected?
async function enrichEventProperties(ctx) {
let event = ctx.event;
console.log(event.type); // Always 'page'
await enrichProperties(event);
ctx.event = event;
return ctx;
}
const eventEnrichmentPlugin = {
name: 'Event Enrichment Plugin',
version: '0.0.1',
isLoaded: () => true,
load: () => Promise.resolve(),
type: 'enrichment',
page: enrichEventProperties,
track: enrichEventProperties,
};
global.analytics.ready(function () {
global.analytics.register(eventEnrichmentPlugin);
});
Metadata
Metadata
Assignees
Labels
No labels