I would like to show different block every second pageview in the sidebar. Unfortunately, the WordPress by default does not utilize sessions. Is there any other way to track the same user’s hits without utilizing sessions? It would be enough to know, if it is first, second, n-th users pageview this visit.
Thanks!
Jonas
There’s a way to do it without sessions but it’s pretty lame (using IP and DB).
You’ll need some PHP code & database.
+Table:
visits1.Someone visits a page on your site , the script will insert to the table the next values:
2.The script will check if the visitor’s IP already exists in the DB and will also check the value of the matched field “is_second_pageview” , if this value is 1 then it’s the seconds pageview , otherwise it’s the 3rd , 5th , … pageview.
The script then will update the value of that field to
0and show an ad to your request.3.Use cron job to delete old rows (according to the
visit_timefield), otherwise this table will be over-populated.