So basically, what I am trying is to build a simple tracker as a method of learning how trackers work. And I stumbled upon my first problem. The scenario is like this:
- Domain A, which loads the JS (tracker) from Domain B
- Domain B, which hosts the tracker and backend
User loads Domain A, and the JS is loaded successfully. A Set-Cookie (name, value, path, expiration) request is sent by Domain B to the user, which receives it (I checked it). However, it doesn't actually set the cookie in the browser. I tried to do the same but everything in the same domain and works, so the problem is that they're different domains.
What is the best workaround for this? Using iframes, maybe? Setting the cookie from the JS reading the response from the server?