I am in the process of developing an Analytics application and I'm seeking a method to uniquely identify each user's device. Currently, my approach involves generating a "cookie" from the server side to track all page clicks and interactions through Ajax requests.
The challenge I'm facing is that my analytics platform is hosted on xyz.com, while applications such as Abc.com and 123.com install my plugin (javascript) code. Upon initial visit, I create a cookie called "sha1" to distinguish each user/device. However, on subsequent requests, I need to verify with the server if the "sha1" cookie exists and take appropriate action accordingly. Unfortunately, due to making cross-domain Ajax calls, no cookies are being added to the request. I've explored options like setting "withCredentials=true" and "crossDomain=true," but have not been successful so far.
I am looking for a solution using Pure Javascript and would greatly appreciate any assistance or recommendations. I am also willing to consider altering my approach if a more practical and straightforward solution is suggested.