Javier Núñez Fernández Full Stack Web Engineer

Tracking pixel. How does it work?

What is a tracking pixel?

A tracking pixel is just a small image (1x1) that allows you to send to the server (or an external one) some information about the action the client is being doing on your site. The src attribute of the image will be the URL of the script where the pixel must be processed. Tracking pixel is a specific implementation of a web bug.

How do I include a tracking pixel in my site?

To include a tracking pixel, you just have to create an image that has an URL as the SRC attribute of the IMG element. For example:

On the script located in http://tracking-server.com/pixel-land.php?cid=3 you can process the request and then use the params you receive by GET to process any information.

Should the response returns an image? If you are making a request, the server will be waiting for a response so, you need to give a response. I can give you two options:

You can think the first option is better, because you are sending no data. But, what does a transparent 1x1 GIF weights? 35 bytes. The worst connection in the world won't appreciate any change.

Why would I need a tracking pixel?

A tracking pixel is used to store information about a user action. It could involve any action that a user takes in your website. It can help to answer this questions:

Lets see an image of a typical "conversion tracking pixel" implementation. A conversion is the moment where a user has made the end-action your website is expecting (subscribe to a newsletter, buy a product, register as a user,...). When the user arrives to confirmation page, then the pixel is sent to the server and processed.

Conversion Tracking Pixel Img

Are there any alternatives to tracking pixel?

Of course. For example, Google Analytics uses mainly tracking code with javascript. There is a javascript code that requests for a javascript file (method), that will be the responsible of processing the information that is sent to it. Pixel tracking is the simplest way of tracking and with tracking code Google Analytics can have a robust API that offers a lot of methods to all their users that can fit any need a an API consumer must need.

References