Cookie tracking demo
Site B
This page and example-a.glitch.me both include an iframe from tracker-site.glitch.me, which uses a cookie to track your activity.
As you navigate between this site and example-a.glitch.me, the content of the iframe will be updated to show that tracker-site.glitch.me is tracking your activity on sites where it has a presence.
How it works
- When you navigate to this page, your browser makes a request to tracker-site.glitch.me for the pink iframe included on the page.
- The first time your browser requests the iframe from the tracker-site.glitch.me web server, it creates a random
id
to identify your browser. The server also records the date/time and referer URL of the request. - In response to the request, the server provides the iframe document, and includes a header:
Set-Cookie: id=<id>
. - When your browser receives the response, it stores the
id
cookie. - The next time you navigate to a page that includes the iframe from tracker-site.glitch.me, the header
Cookie: user-id=<id>
is included in the request for the iframe (if third-party cookies are not blocked). - When the tracker-site.glitch.me web server receives the request, it gets the cookie value, and checks if it already has a record for that
id
. If so, it adds the details of the current request to the history it has stored. Otherwise it starts a new entry for theid
. - The iframe content provided in the response is updated, to display the browsing activity that tracker-site.glitch.me has recorded.