custom ads

Any feature requests, please post here.
Post Reply
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

custom ads

Post by River »

I think it would be good if there was a way to have custom ads on specific forums.

I know adsense is pretty good, but I read on another forum that this guy (a forum host like us) got increased revenue when he created a mod for his multiforum software that allowed him to have custom ads for large niche forums.

For example, he claimed he got more money using CPA ads for a car magazine on one of his car forums than the adsense CPC ads.

I'm not sure if what he says about increased ad revenue is correct, but it would be cool to have those options to test out different alternatives. I don't trust adsense. For many of my niche forums it still shows "buy world of warcraft gold"...
River
Posts: 124
Joined: Sat Feb 10, 2007 9:51 pm

Post by River »

Bump. I am posting the message for the custom ad mod for the other multiforumsoftware. (Btw, that multiforum software is really bad, believe me (I tried it before I came to echophp and it was so bad I had to change to this great software) but sometimes I check their boards for ideas from members, because there members can make mods for the software. And this idea seems good.) Do you think it is possible with a mod like this for echomf?
First of all, I'm not a php guru or something so there might be some tweaking in this little "mod" for you guys.

My adsense revenue dropped over 500% after the new year, so I had to look for something else to monetize my site. I have over 2000 forums on my site and there are some very popular ones too with specific niches. There are good number of advertising companies which offers CPA ads. However, problem with these ads is that you have to have right audience for those.

As you all know, you can't customize your ads with this software, so same ads are shown for all forums. I was looking a solution for this, but there wasn't any ready. However, on phpbb.com I found this little mod (]http://www.phpbb.com/phpBB/viewtopic.php?t=431042) . I installed it on my site and I was able to show custom ads on a single forum (forum and topic view). However, I had to edit ads from phpmyadmin directly. From there it took ages to edit ads for forums so I decided to edit admin panel and include this mod in there. Mod also adds forumwide ads instead of just forum and topic view.

I have tested it now on few big forums on my site and my revenue is back on the level it was on december and I should atleast double it when I have finished my work on custom ads on forums. Using CPA ads on niche forums (Car magazine ads on motor forum for example) generates much more revenue that those low CPC clicks from adsense.

So here's what I did:


CODE
#
#-----[ SQL ]-------------------------------------------
#
# You have to do this for all existing forums

CREATE TABLE phpbb_ads ( sponsor text NOT NULL );
INSERT INTO phpbb_ads ( sponsor ) VALUES ('');

#
#-----[ OPEN ]------------------------------------------
#

forum2.php

#
#-----[ FIND ]------------------------------------------
#

CREATE TABLE phpbb_words (
word_id mediumint(8) UNSIGNED NOT NULL auto_increment,
word char(100) NOT NULL,
replacement char(100) NOT NULL,
PRIMARY KEY (word_id)
);

#
#-----[ AFTER, ADD ]------------------------------------------
#

CREATE TABLE phpbb_ads ( sponsor text NOT NULL );
INSERT INTO phpbb_ads ( sponsor ) VALUES ('');

#
#-----[ OPEN ]------------------------------------------
#

includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#

//
// The following assigns all _common_ variables that may be used at any point
// in a template.
//

#
#-----[ BEFORE, ADD ]------------------------------------------
#

$sql = "SELECT sponsor FROM ".MFORUM."_phpbb_ads";
if ( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not select forum sponsor data', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
$forum_sponsor = $row['sponsor'];
}

if ($forum_sponsor != '')
{
include_once($phpbb_root_path . "includes/bbcode.$phpEx");
$forum_sponsor = bbencode_first_pass($forum_sponsor, '1');
$forum_sponsor = bbencode_second_pass ($forum_sponsor, '1');
$forum_sponsor = smilies_pass ($forum_sponsor);
$forum_sponsor = str_replace("quote:1", "quote", $forum_sponsor);

}


#
#-----[ FIND ]------------------------------------------
#

$template->assign_vars(array(

#
#-----[ AFTER, ADD ]------------------------------------------
#

'FORUM_SPONSOR' => $forum_sponsor,

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/overall_header.tpl

#
#-----[ ADD ]------------------------------------------
#
# Add this to the spot you'd like ads to appear


{FORUM_SPONSOR}


#
#-----[ OPEN ]------------------------------------------
#

admin.php

#
#-----[ FIND ]------------------------------------------
#

<tr>
<td class="row1"><span class="genmed"><a href="admin.php?action=addads" target="main" class="genmed">Add Ads to a Forum</a></span>
</td>
</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#

<tr>
<td class="row1"><span class="genmed"><a href="admin.php?action=forumads" target="main" class="genmed">Custom Ads</a></span>
</td>
</tr>

#
#-----[ FIND ]------------------------------------------
#

</body>
</html>';
exit;
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

if($_REQUEST['action'] == 'forumads')
{
$result = mysql_query('select * from phpbb_forums');
while($row = mysql_fetch_assoc($result))
{
$flrow .= '
<tr>
<td class="row1" nowrap="nowrap">'.$row[name].'</td>
<td class="row2"><b><a href="admin.php?action=forumads2&access='.$row[name].'">Click Here</a></b></td>

</tr>';
}
if(!$flrow)
{
$flrow = '<td class="row1" nowrap="nowrap" colspan = "2">No forums!</td>';
}
amfr_header();
print '
<h1>Admin</h1>

<h1>Custom Ads</h1>

<table width="100%" cellpadding="4" cellspacing="1" border="0" class="forumline">
<tr>
<th nowrap="nowrap" height="25" class="thCornerL">Access Name</th>
<th height="25" class="thTop">Manage ads</th>
</tr>
'.$flrow.'
</table>';
amfr_footer();
exit;
}
if($_REQUEST['action'] == 'forumads2')
{
$result = mysql_query("SELECT * FROM $_GET[access]_phpbb_ads")
or die(mysql_error());
$row = mysql_fetch_array($result);
amfr_message_box('Information', '<form action="admin.php" method="post">
<input type="hidden" name="action" value="forumads3">
<input type="hidden" name="access" value="'.$_GET[access].'">On this page you can add custom ads for '.$_GET[access].'.

<textarea name="ads" cols="40" rows="15">'.$row['sponsor'].'</textarea>
<input class="mainoption" type="submit" value="Add ads"></form>');
exit;
}
if($_REQUEST['action'] == 'forumads3')
{
$access = $_POST['access'];
$ads = $_POST['ads'];
mysql_query("UPDATE ".$access."_phpbb_ads SET sponsor = '".$ads."';");
amfr_message_box('Information', 'Ads added

Click <a href="admin.php?action=forumads">Here</a> to return to "Custom ads"');
exit;

}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM


Now you can add custom ads to a forum. Just remember to remove other ads for forums you are using this.

I suggest that you use this for niche forums and show Adsense ads on others.

Edited: Better, forumwide code
echophp
Posts: 657
Joined: Sun Feb 11, 2007 9:07 am

Post by echophp »

Thank you River, I will include this feature for echoMF in another way that allows you do it via your MF admin. But it will be included for the updates of the version 2, not the first version 2.
Post Reply