Store referral info in registration flow

How could a cookie value be stored when an user signs up via Keycloak?

For example, we might have the cookie referral with the value abcd. Is there a way to store this value in the user table when a user signs up via Keycloak (either through email or Google/Facebook social login)?

Alternatively, could this be done with a passed parameter?

This github issue seems to have a possible solution: How to pass custom attributes to the registration form? · Discussion #9449 · keycloak/keycloak · GitHub

However, I’m still figuring out how to do this with the Java SPI. The way I understand it is that 2 authentication steps needs to be implemented to pass the value around.