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
I developed a similar plugin for my own porpouse, logging each visit in a sqlite file. But after a few months, the main table has more than 500K records⌠I should consolidate each monthâ visit on a separate table⌠Is your plugin doing something like that? In other words: how do you prevent the risk of having too much records in the db?
my plugin intentionally does not track history as events (like retrour plugin does) but only a single integer and timestamp per page. pretty much like olden days cgi open tracker but with better bot detection.
It could be enough for me. But - if I get 100 pageviews each day for every single page of my site, and my site has 10 pages, at the end of the year will I have 10010365 records in a single table?