So your question is why its not setting the cookie?
It could be a million reasons, but mostly because the browser doesn't like the cookie information you're feeding it.
Maybe it considers it a 3rd party cookie, who knows.
What you want to do is specify every part of the cookie (domain, path ... refer to docs).
MJDsays "you can't just make shit up and expect the computer to know what you mean, retardo!"