Not actually illegal depending on where your from, unethical, maybe.
First thing though is you must be able to place a payload at xyz site. With forum software linking a generated image which places the payload from your site is probably the best method. However since we are dealing with generated images a payload may not be necessary as you can just check the credentials of the request.
However in any matter you must be able to link some loaded resource, if you can't then it is practically impossible.
Main reason Amazon and Google are so successful at this is there are plenty of sites using their resources which gives them more opportunities to snoop around.
What I mentioned above may be a little misleading and doesn't actually read another's sites cookies as for security reasons on almost every browser this isn't possible. It merely gives a example where if your allowed on xyz site to hotlink a resource from your site then you can possibly observe that the user has visited xyz site.
Like mentioned above reading another sites cookies is illegal and unethical, sorry I must have skipped over that somehow, but if the webmaster has given you some sort of foothold to place resources on their site then you don't even have to do that to figure this out.
This is how Google, Facebook and the rest do it. Say for instance you visit a page, but webmaster doesn't have to be using AdSense in order for Google to figure you visited it. The page can be using a font, a hosted library such as jQuery and even Recaptcha in order for Google to figure out you have visited this page. Facebook may do this with their like buttons and site comment system.
In the end the webmaster must be using your resource or give you the opportunity to post your resource. This is why I mentioned images as it is the easiest one. With forum software you can hotlink an image from anywhere, however you'll only be able to see if the user has visited that post within xyz site and nothing more. If the user visits xyz site and never reads your post then your out of luck.