Forum Moderators: martinibuster
Great info here. I put adsense on my site and then I put it on the site forum and the CPM's tanked big time. I get about 50 new members a month on the forum so how do I create a cookie so after the first 10 page views the ads go away?
I've read on here that this will help.
I'm pretty familiar with the phpbb code that runs the forum.
On each of your pages, you could put:
<?
session_start();if (!$_SESSION['viewcount']) {
$_SESSION['viewcount'] = 0;
} else {
$_SESSION['viewcount'] = $_SESSION['viewcount'] + 1;
if ($_SESSION['viewcount'] > 10) {
setcookie("showads_no", "no", time()+604800); //expires after 1 week
}
}
?>
Then, around your AdSense code, you could put:
<?
if (!isset($_COOKIE["showads_no"])) {
//Insert Google AdSense Code here//
}
?>