title: How do third party analytics work on a site?
body: <p>I'm just familiar with Javascript at the very basic level. My question is, how do third party sites collect data from your site, when you paste some JS code they provide on your site. For e.g, how does Google analytics or user analytics sites like Crazyegg collect used data from your site and send it to a third party? What JavaScript concepts are involved? Can you point me in the direction of some resources for the same? </p>