PHP

Total page hits/unique visits snippet

Filed under:  Google about "Drupal" |  Google about "PHP"

I just thought it would be nice to share how do I display the total page hits and unique visits counter on this site's footer.

The following is a small code snippet that you can place wherever you wish, for instance on a block or a PHP template. Of course, you can change the message or customize the look to suit your needs. :-)

<?php
// please, enter to view the snippet
?>

It uses the Drupal functions variable_get and variable_set to store the data. There's no admin interface to manage these variables. If you want to modify or remove them, you need to edit the drupal variables table.

Functions used to format the counter: (PHP) number_format and (Drupal) t and format_date.


Syndicate content