I am creating posts for my plugins to make it easier to find them using the forum search and not just the docs search.
By default this plugin will just write count and timestamp per page into an sqlite file since that is the fastest and best suited solution for concurrent requests. But you can also use fields (see readme) and store that directly on the page content file.
Echo the tracking 1x1px image anywhere in your template.
Hello,
Iâm trying to use your plugin for display the number of views for each articles in a blog, and for sorting them by âpopularityâ.
But the <?php echo $page->counterImage(); ?> doesnât display anything,
does anyone use this plugin ? Or have the same problem ?
I reload in differents browsers, and in private tab and itâs finaly working, thank you!
I was also looking for a way to display the counter in front-end, the solution is :
Is there a way to make a sortBy() on the count($id) for a blog ?
Something like : $mostclicks = $page->children->sortBy(\Bnomei\PageViewCounter::singleton()->count($id), 'desc');
Itâs working with Page Methods and not Pages Methods I donât really understand why, is it because the PageViewCounter in accessible from my blog page (and children) and not from all other pages ?
Thatâs my mistake, sorry for that. Should have been page method, of course. Hit the wrong page in the docs and then copied blindly from the wrong exmaple.
@bnomei Thank you very much, I very like the simple approach and plugin! So, to my understanding, a page view is what used to be called âimpressionâ back in the days, aka if I navigate to the page, then somewhere else and then to that page again it will add another page view? I still remember back then we also had something like âunique visitorsâ, which just tracked the visitors.
Also do you need to add any GDPR notice the user has to confirm? Iâd prefer not to, as kirby comes with privacy by default too.
it will record each visit to a page using Pixel tracking and like you said even records repeated visits by the same visitor. i wanted it to be as simple as possible with the use-case for recording visits not browsing behaviour.
i can not give you any legal advice on GDPR but since the plugin is no storing any user data, nor is it persisting any user data within the session itself i would assume you are actually not doing any âtrackingâ but just âcountingâ.
some related reading: Compliant Website Tracking Guide: How To Track Users Legally - Termly