-
-
Notifications
You must be signed in to change notification settings - Fork 258
Description
As per the docs you can send events to a single destination with the following properties when sending the event:
analytics.track('eventName', additionEventProps, {
plugins: {
// disable this specific track call for all plugins except customerio
all: false,
customerio: true
}
})This would disable all plugins except customerio and therefore the data would be sent onto to customerio.
A common use case for plugins is to enrich data or do something else that is not related to sending data to a provider (e.g. filtering events).
However, the use of all: false also disables any enricher-only plugins you might be using meaning that you need to have event configuration like:
analytics.track('eventName', additionEventProps, {
plugins: {
// disable this specific track call for all plugins except customerio
all: false,
customEnricher: true,
customerio: true
}
})This can be quite error-prone as its not immediately obvious that all: false will have side effects of turning off enrichers and means that developers need to always be mindful of re-enabling any custom plugins following an all: false.
It would be great if there was an option for a plugin to be able to ignore the all: false flag and always be enabled in this scenario.
Something like:
export default function customEnricherPlugin(userConfig) {
return {
name: 'custom-enricher',
alwaysEnabled: true, // <- something like this or ignoreAll: true
config: {
whatEver: userConfig.whatEver,
elseYouNeed: userConfig.elseYouNeed
},
initialize: ({ config }) => {
// ...
},
track: ({ payload }) => {
// ...
},
...
}
}