This message was deleted.
# ask-questions
w
This message was deleted.
f
I'm not sure any of the usual analytics SDKs work with middleware right now since neither NodeJS nor browser APIs are fully supported. For Segment, you should be able to track events using their HTTP endpoint instead of the
analytics-node
package - https://segment.com/docs/connections/sources/catalog/libraries/server/http-api/
The other option is to pass the assigned variation down to the client in a cookie and call Segment from the front-end. That approach is pretty messy though, not sure I would recommend that.
b
Thanks, I will give http endpoint a shot! 👍
n
Another tip is to track the event inside the
waitUntil()
method to avoid a timeout if the analytics endpoint responds slowly. See more here: https://vercel.com/docs/concepts/functions/edge-functions#nextfetchevent
👍 1
194 Views