Page view count, per session - template variable


Active member
Can anyone help with this......

We use a really good ad network, ebuzzing, in addition to adsense, rubicon and so on. The problem is with our use of ebuzzing in the forums is that the overlay footer ad it produces can be closed, but then it's there again when you refresh the page. This becomes annoying.

My quick fix solution is to show it randomly once in every five page views. This is better but not ideal. The ideal would be to show it to a user on, for example, their first, fifth, tenth... page view, but for this I need a count of pages viewed per session in the template.

One option is to use a javascript cookie (eg ), but I wonder if there is a neater server-side solution using Xenforo's session system. It would just need to produce the view count as a template variable.

Any suggestions as to the feasibility of this and how to do it would be very welcome!