I’m trying to build a simple affiliate program for my web app.
If a user (let’s call him X) is referred by another one (let’s call him Y), I would like to increase the number of sign-ups brought/ referred by user Y.
So, in the sign-up workflow I added this step:
Y’s affiliate ID is stored in its “Current User” thing as affiliateID.
X’s refferedby is saved in its “Current User” thing, too and represents the affiliate ID of the person who sent him/ her to my app (Y in this case).
X will have a cookie that contains Y’s affiliate ID.
And I want to increase Y’s affiliatesignups with 1 when X is referred by Y and sign-ups in my app. To do this, I’m searching user X after the affiliateID and modify its affiliatesignups field by increasing its value with 1.
However this doesn’t work. What am I doing wrong?