View counter in strapi: With lifecycle hooks? But how to use them?

Are you using any cache middleware?

If you only want the logic to happen on the API side, then a route policy might be better (but a cache middleware will still conflict with this)