Greetings! I am implementing Growthbook for a/b t...
# ask-questions
b
Greetings! I am implementing Growthbook for a/b testing in a next13 environment that deploys to Vercel. Currently the plan is to utilize edge middleware to handle rewrites to variant pages in a fashion similar to the Vercel Optimizely demo repo. The middleware is currently "working" in that based on which group I'm bucketed into I see the correct rendered page content. Unfortunately it's also broken in the sense that my
$experiment_started
events in mixpanel never show up. I have verified that
trackingCallback
in the middleware is being fired so I'm not clear as to what's happening. At some point I thought that maybe the middleware was completing before the call to mixpanel could actually fire so I wrapped the
mixpanel.track
into a promise that resolves itself in a callback passed to
mixpanel.track
and then added
NextFetchEvent#waitUntil
on the promise in question. This should have ensured that the middleware waits on the promise to resolve before moving on but unfortunately this had no discernible effect. I removed this extra complexity sometime yesterday prior to writing this message so it's not reflected in the pastebin example. At this point I'm not sure what else to try other than maybe plug in some other library for tracking. This is my first time using both Growthbook and Vercel middleware so it's totally possible that I'm doing something naïve. I hope that's really the case! For context I've included the contents of the middleware in question below.
lib/growthbook/features.json
is populated at server start and as part of the build process. https://paste.laravel.io/4d138b7e-7f96-4ce2-b074-d837ae2d9900