1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Page view count, per session - template variable

Discussion in 'XenForo Development Discussions' started by hqarrse, Apr 25, 2014.

  1. hqarrse

    hqarrse 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 http://stackoverflow.com/questions/11781864/using-a-cookie-as-a-counter ), 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!
     

Share This Page