Tracking pixel demo
Site A
This page and tracking-pixel-b.glitch.me both include a single-pixel image from tracking-pixel-server.glitch.me, which allows a cookie to be used to track your activity.
Both pages also include an iframe from tracking-pixel-server.glitch.me that shows page visits recorded on pages that include the tracking pixel image.
As you navigate between this site and tracking-pixel-b.glitch.me, the content of the iframe will be updated to show that tracking-pixel-server.glitch.me is tracking your activity on sites that include the tracking pixel.
Refresh this page to update the list of page visits in the iframe.
How it works
- This pages includes a transparent, 1x1-pixel image from tracking-pixel-server.glitch.me:
<img src="https://tracking-pixel-server.glitch.me/images/tracking-pixel.png">
- The first time your browser requests the image, the web server at tracking-pixel-server.glitch.me 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 image, 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 tracking pixel image from tracking-pixel-server.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 tracking-pixel-server.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 tracking-pixel-server.glitch.me has recorded.