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 DemoConcept 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
- First Download PrinTrac.php from GitHub: Download
- Place printrac.php into your site's image directory or anywhere you want.
- Create a directory in the same folder named 'logs'
- 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; }
- 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>
- That's it!
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