How to Use Pixel Tracking

By Jack Gerard

Updated September 28, 2017

Pixel tracking is used to monitor the flow of traffic to specific pages of your website.
i Hemera Technologies/ Images

Monitoring how visitors use your website is an important part of being a webmaster, regardless of whether you're running a personal site or an ecommerce store. One method of monitoring visitor usage is pixel tracking, a process that involves placing small 1x1 images on specific pages, so you will know when visitors load that specific page. Though there are a number of analytics programs that can automate the pixel tracking process, you can do basic pixel tracking with nothing more than your website's usage statistics.

Create an image with a height and width that are both one pixel. Color the image so that it is the same color as your website's background or make it transparent if using graphics software such as the GIMP, Photoshop or Paint Shop Pro that supports transparency. Save the image as a .gif or .png file, giving it a descriptive name so that you can easily recognize the page that the pixel is tracking.

Upload the tracking pixel image to your website's server. Place it in the folder where other images for your website's pages are saved.

Open the page you want to add pixel tracking to in a text or HTML editor, either on your server or on your computer. If your server offers online editing then this will allow you to implement the pixel tracking immediately; if you implement it on your computer you will still need to upload the page to the server for pixel tracking to work.

Select a location on the page within the "body" tags of the page's code. Add the line "" without the quotes on the outside, with "img_dir" being the name of the directory folder that your image is saved in and "img_name.gif" being the name of the pixel image and its extension.

Save the page and upload it to your server if necessary. Each time the page is viewed, the single-pixel image will be loaded but will not be visible to the user. Each of these views will increase the view statistics for the image by one in your website's usage statistics.


By placing a tracking pixel on the page that displays after a successful purchase, you can track sales independently from your website's payment processing service. Creating multiple copies of your tracking pixel image and giving each copy a unique name allows you to set up tracking on multiple pages. The viewing statistics for each image indicate how many views the specific page it was on received.


Basic pixel tracking does not take into account situations such as users reloading the page that the pixel appears on, so the number of views for a pixel may not correspond exactly with the number of actual unique visits to the page. For more accurate pixel tracking, an analytics service is necessary.