Forum Moderators: martinibuster

Message Too Old, No Replies

Cookie for Forum with adsense

         

thebirdbath

6:29 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



Hey,

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.

Vastio

7:21 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



I have a similar thing on one of my pages. I don't have it integrated with phpBB, but it'll work for what you need.

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//
}
?>

Jafo

10:39 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



I always find that normal forum users don't click ad's at all. I only show them to unregistered users.

endomorph1

10:44 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



With so many "internet security suites" around these days, I found that cookies are not reliable enough.

I use a page view variable and session ID's instead.

thebirdbath

11:19 pm on Apr 6, 2006 (gmt 0)

10+ Year Member



endomorph1,

Can you tell me more or post the code you use?

This is my 3rd day fellas. The first two days I made just over $20 bucks each day. Then I posted my ads on the forum, NOSE DIVE! I'm at like $2.50 for today.

Any help would be appreciated.

thebirdbath

7:06 pm on Apr 7, 2006 (gmt 0)

10+ Year Member



The code above didn't work. I placed the adsense code in my header TPL file and that works, but when you place php in that file, the phpbb board goes down.

Anybody have any experience working with a cookie in a PHPBB forum or equivalent?

HELP!

Vastio

10:09 pm on Apr 7, 2006 (gmt 0)

10+ Year Member



I wrote it too quickly...

Instead of:

<?
if (!isset($_COOKIE["showads_no"])) {
//Insert Google AdSense Code here//
}?>

Put this:

<?
if (!isset($_COOKIE["showads_no"])) {
?>
//Insert Google AdSense Code here//
<? }
?>

And as always, you should test it on a dummy site first.