Setting the user id

Hi,

I’m wondering what happens if I set the user id with different methods at the same time? Is there some priority? Say I usually have the user id from a cookie ( setUserIdFromCookie) and want to use setUserIdFromLocation for specific cases. Do I have to write logic around it or is there a natural order?

Best
Andreas

Hi @volderette,

Good question. I’m not 100% sure on this but as far as I understand, it wouldn’t be deterministic, and would depend on when the method happened to be called.

I would probably recommend sticking to one method for setting the user id. If the user_id is in the querystring (as it normally would be for setUserIdFromLocation), you could simply parse it from the data in modeling stage. Otherwise, you can also send the desired user id in a custom context.

Hope that helps!

Best,

Thank you very much @Colm! Definitely a good idea to take care of it in the modeling.