spode Posted July 20, 2007 Share Posted July 20, 2007 Is there a function (or way) to see how many times a user has viewed a page during a session? I've been searching for quite a while and have come to a speed bump. Quote Link to comment Share on other sites More sharing options...
volatileboy Posted July 20, 2007 Share Posted July 20, 2007 set a session variable and increment it by 1 each time the page is loaded Quote Link to comment Share on other sites More sharing options...
TheFilmGod Posted July 20, 2007 Share Posted July 20, 2007 Do you mean a single page. In your explanation you said a page. If so, the previous post wouldn't work since it would count each page view. We want a page - same page? Quote Link to comment Share on other sites More sharing options...
benjaminbeazy Posted July 20, 2007 Share Posted July 20, 2007 this should work under most circumstances, you may have to look out for how you name pages session_start(); $pageCount = 'page_'.$_SERVER['PHP_SELF']; $parts = explode(".", $pageCount); $pageCount = $parts[0]; $_SESSION[$pageCount]++; echo "Number of pageviews this session: ".$_SESSION[$pageCount]; Quote Link to comment Share on other sites More sharing options...
spode Posted July 20, 2007 Author Share Posted July 20, 2007 yep, that worked, thanks a lot Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.