Hacker News new | past | comments | ask | show | jobs | submit login

Imagine that you want your web page to send a message "gphil clicked this link X" back to the server, but you're only allowed to request information, not gather it. The work-around that we use in web analytics, is that we request an image named "link-clicked.gif?dude=gphil&link=X." The query parameters are built dynamically with JavaScript and the image request is added as an on-click call on the link. The server is configured to accept this request and parse and log the data from the query parameters, and meanwhile returns a .gif image consisting of a single transparent pixel. This script apparently doesn't even render the pixel, it just stores it somewhere.

Advanced techniques include noscript fallbacks and adding a timestamp to prevent client or server caching from messing with your data collections.




That's pretty cool, thanks for explaining.


Keep in mind, because the image involves an http get request, the host of said transparent dot can also dump a cookie on you; this is how a lot of advertising agencies track conversions for cost-per-action ads. They tend to drop them for cost-per-click ads too, just to be extra annoying :)


Thanks. What's the distinction here: "but you're only allowed to request information, not gather it"?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: