Fork me on GitHub

Website Printing Stats, for the Curious M

Welcome to PrinTrac.php Demo Page

This is just a quick demo page. If you print or print preview this page and then click the button labeled "View Print Stats" you will see the date/time and your IP address in the detailed logs section of the stats page.

Your IP Address is: 3.83.187.36

View Print Stats

How to Uses/Installation

To use PrinTrac.php you simple upload a PHP file, Add a some section of code to your webpages, and add a bit of code to your print stylesheet.

Installation

  1. Step 0: Download PrinTrac.php from GitHub

  2. The first thing you need to do is upload printrac.php to your website, for example to its own directory. Next you need to create a new directory in the same folder that printrac.php is in, so it can have a location to store the logs. You need to create a directory named logs.

  3. Now that PrinTrac.php is on your website you need to add the following code to your webpages. Place the below code right before the closing body tag on your webpages

    <!-- PrinTrac.php Tracking Code - http://madscitech.com/m/10 -->
    <script src="/path/to/printrac.php?js"></script>
  4. The last thing you need to do is add the following code to your print stylesheet:

    body:after, .printracphp-ie{
      background:url(/projects/printracphp/printrac.php?track) no-repeat;
      content: url(/projects/printracphp/printrac.php?track);
      width: 1px;
      height: 1px;
      display: block;
    }

    If you don't have a print stylesheet, you can create one very easy. The easiest way is to put your current CSS into a media declaration by surround all of your css with:

    @media screen{
      # Your Current CSS is here
    }

    Then add the above code either above or below your the current CSS that is now wrapped with the @media print.

  5. That's it! PrinTrac.php is now installed!
    To test it out, print preview a page with the tracking code and the new CSS on it - then navigate to: http://your-domain-name.example.com/path/to/printrac.php?gui and you should see a print recorded!

Download & Install

Viewing the Logs

To view the pretty logs that PrinTrac.php create, point your web browser to

http://your-domain-name-here.example.com/full/path/to/printrac.php?gui

FAQs

How secure is the print records?
The logs are unsecure by default. The only way to access the logs, is if someone has the link to the script and URL query string.
How do I access the logs?
Visit the following URL, substituting as needed: http://www.your-domain-name.com/the/full/path/to/the/file/printrac.php?gui.
What technologies are required for this to work?
PHP and Javascript
I found a bug! How do I report it?
Thank You for a Start! You can report the bug in the issue tracker on GitHub or Submit it via my contact form.
What is this project licensed under?
BSD License, please see the bottom of PrinTrac.php file for full license.
I want to help the project?
If you want to help, you can either make a pull request on GitHub or Contact me directly via my contact form
What Browsers are Supported?
Any browser that support CSS and Javascript. PrinTrac.php has been fully tested in:
  • Firefox 10
  • Chrome 17
  • Opera 11.61
  • Safari 5.1
  • Internet Explorer 8