Sounds to be close to the wikistats plugin, see
https://www.dokuwiki.org/plugin:wikistats. Maybe you can have a look at that. And if it is not exactly what you need you could contact the author. Maybe he is willing to add a new feature to the plugin. This would be better than someone creating a completely new plugin.