analytics-node icon indicating copy to clipboard operation
analytics-node copied to clipboard

Support middleware functions

Open Mihailoff opened this issue 2 years ago • 8 comments

Browser library has a handy feature that allows using middleware functions.

https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/middleware/

Mihailoff avatar Aug 03 '22 20:08 Mihailoff

Could you explain what is your issue, please?

edsonjab avatar Aug 11 '22 16:08 edsonjab

Filter events (or prevent tracking) dynamically based on the business rules.

Mihailoff avatar Aug 11 '22 18:08 Mihailoff

Would using a source middleware read this documentation, please

edsonjab avatar Aug 11 '22 22:08 edsonjab

Server-side (analytics-node) is different from the source middleware that we use already. Not sure what you mean.

Mihailoff avatar Aug 15 '22 04:08 Mihailoff

@Mihailoff I believe there is some confusion as to exactly what the issue is you are having. Are you unable to filter events using your/our middleware solution? Are you describing a solution for another issue you may have had? I believe we just need some clarity on what the issue is exactly so we can better assist you in resolving it. Thank you.

nd4p90x avatar Aug 15 '22 15:08 nd4p90x

The client (browser) library has middleware functionality, I thought it would be logical to port the same approach to the server side. My issue is that I need to filter events based on dynamic rules -- custom middleware is a perfect solution for it. Client and server are different data sources.

Mihailoff avatar Aug 17 '22 02:08 Mihailoff

@Mihailoff We are working on Node runtime support with https://github.com/segmentio/analytics-next (AJS 2.0) ... so you can use analytics-next to instrument a node-js applications. AJS comes with a plugin architecture, so you can register plugins to modify the payload before they are sent to Segment. Will keep this issue updated as we release the Node support for AJS 2.0

pooyaj avatar Aug 17 '22 18:08 pooyaj

Middleware support is in the new analytics node: https://github.com/segmentio/analytics-next/tree/master/packages/node

silesky avatar Aug 17 '23 15:08 silesky