$_COOKIE is not returning the value as expected.

I am working with my developer and we are trying to implement an affiliate system that stores the ID from the URL to a cookie. We were using "r" as a parameter for URL referer earlier and now we are using "id".

The problem is that this implementation randomly keeps returning "public.min.js" and "public.min.css".

Can someone assist with this?