Couting views of page

I need to count and display visits to individual pages. I wrote my own function for this. However, it only works when the frontend cache is cleared. I’m using Typo3 v12.2 and the fluid template. I found the cache.disable option but including the block that is responsible for calling my function with it does not change anything, it still works only on the first call after clearing the cache.

With TYPO3 v9 and newer I would suggest to use a middleware (custom one), which is registered after page resolving has been done but before the rendering.

dispatch the reqest further down and on the response make quick and fast count incrementations for your current page - costly aggrecations should be put in a queue and processed later (v12 symfony message bus for the resqueue for that).

If you need it some where bi directly shown, make the place output some kind of placeholder … than the middleware can simply replace the placeholder in the response content and return the response further up

1 Like