You are misunderstanding how the same-origin policy applies to scripts. If a page on mysite.com loads evilsite.com/tracker.js, then tracker.js runs with the same "origin" as the rest of the page that loaded it. The script has all the same access, including document.cookie, as a scripts loaded from mysite.com. Try it.
The same-origin policy only limits access between windows and frames. All scripts loaded on a page will have the same "origin".
The same-origin policy only limits access between windows and frames. All scripts loaded on a page will have the same "origin".