It seems to only work when I go to the page with the refid link, then visit another page and go back to the form.
So if you go straight to the refid link and fill out the form, it doesn't record the refid into the csv.
I tried messing around with the code but nothing I did seems to fix it

Could you help me with this?