Title: Statistics plugin
Last modified: August 18, 2016

---

# Statistics plugin

 *  [indeed](https://wordpress.org/support/users/indeed/)
 * (@indeed)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/statistics-plugin/)
 * Hi,
 * I’ve created a PHP-file to be able to log visitor-information into a database.
   Another file, the front-end, shows the statistics. For an example, please visit
   [this site](http://www.LommersOnline.com/stats) (front-end).
 * To collect the user-information, a couple of php-lines have to be executed for
   every page-visit. I’ve edited one of my template files and added the PHP-code.
 * But I think it’s nicer to deal with the code by using a plugin. So I want to 
   write a plugin by myself. The only thing the plugin has to do is the following:
 * – For every visit: run a couple of lines of PHP-code.
 * How to create such a plugin?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael Bishop](https://wordpress.org/support/users/miklb/)
 * (@miklb)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/statistics-plugin/#post-409505)
 * I’m not a coder, but basically you would create a new function, and then use 
   a hook to call the function where you wanted it to be executed.
    [http://codex.wordpress.org/Writing_a_Plugin](http://codex.wordpress.org/Writing_a_Plugin)
 * SHould be a good starting point, and you can always check back with more specific
   questions, though the forums tend not to get too technical in regards to coding.
   There’s a hacker list for that.
    [http://lists.automattic.com/mailman/listinfo/wp-hackers](http://lists.automattic.com/mailman/listinfo/wp-hackers)
 * Hope that gets you on your way.
 * Another suggestion would be to look at some other plugins and see how they are
   constructed.
 *  Thread Starter [indeed](https://wordpress.org/support/users/indeed/)
 * (@indeed)
 * [19 years, 11 months ago](https://wordpress.org/support/topic/statistics-plugin/#post-409673)
 * Already found out which ‘Hook’ to use. It was the ‘shutdown’-hook. Please have
   a look at my Plugin: [http://www.lommersonline.com/archives/387](http://www.lommersonline.com/archives/387)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Statistics plugin’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [indeed](https://wordpress.org/support/users/indeed/)
 * Last activity: [19 years, 11 months ago](https://wordpress.org/support/topic/statistics-plugin/#post-409673)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
