I am currently trying to develop a medusa plugin for my ads tracking tool, for wich I need a session Id wich is sent to the tracking app api. How can add a custom cookie value to the medusa cookies? I am currently reading into the stripe plugin because I seen after adding this one to my medusa app there was a stripe session Id value added to the cookies, just like that I need a cookie value wich is added by my plugin. But I haven't find any specific code wich does that.
#Add custom cookie value for tracking plugin
5 messages · Page 1 of 1 (latest)
do you mean you need to create a new httpOnly cookie for your plugin ?
I haven't thought about that to be honest. Will the cookie value also be accesible in the nextjs frontend then? Because for purchase events I would use the medusa order.placed event, but for the remaing events like PageView and AddToCart I need to send POST requests from the NextJS frontend. If its still accesiable there then yes I can use httponly, otherwise not. Sorry for all the confusion, still new to full stack development with JS, only had expierence with C# until now😅
Yes of course, an httpOnly cookie is sent back by the API (Your Medusa.js server in that case) so no problem, you'll need a custom API route to do this, basically it just a header sent back with the response 👍
Ok I will read into that and try to code that. Thx a lot