Fork me on GitHub

PrinTrac.php

How Often Are Your Webpages Being Printed? M

What is PrinTrac.php?

PrinTrac.php is a simple script that tracks how often users print your web pages by using a invisible tracking image that is included in your print stylesheet.

Try the Demo

Concept and Origin

This idea is from ShopTalkShow Host Chris Coyier and a user submitted question (Sorry I don't remember the listener's name) from ShopTalk Show - Episode 006 with Zoe Gillenwater.

Why Should I Use It?

There isn't really a great reason to use it. It's just some simple statistics about your website visitor's printing habits.

Installation and Use

  1. First Download PrinTrac.php from GitHub: Download
  2. Place printrac.php into your site's image directory or anywhere you want.
  3. Create a directory in the same folder named 'logs'
  4. In your Print CSS file Include the following code:
    body:after, .printracphp-ie{
        background: url(/path/to/printrac.php?track);
        content: url(/path/to/printrac.php?track);
        height: 1px;
        width: 1px;
        display:block;
    }
  5. Insert the below script tag before the closing body tag on your webpages you want to track.
    <script src="/path/to/printrac.php?js"></script>
  6. That's it!
Download & Install

View Logs

To view the logs that are created by PrinTracs visits the following link:

http://www.your-domain-name.example.com/path/to/printrac.php?gui
http://www.your-domain-name.example.com/path/to/printrac.php?view=gui

Try it out!

Open the the below page and do a print preview of that page. Then click the link label View Logs. If you view the newest records at the bottom of the page you should see your IP and the date/time you "Printed" the page.

Try the Demo

Follow PrinTrac.php on GitHub