Hi there.
So, you want that counter one specific page or on your whole website? Anyways, this can be done by tracking the IP connection or username connection on your server and after X amount, it will send the instruction to the client to redirect to some other place.
Better and easier way is to create a simple browser extension that will track that same thing without the intervention of your server.
Anyways, feel free to hit me up so we can talk more about this. I am very responsive. All the best