Scoop -- the swiss army chainsaw of content management
Front Page · Everything · News · Code · Help! · Wishlist · Project · Scoop Sites · Dev Notes · Latest CVS changes · Development Activities
Scoop Box Exchange - Show Box: adman_showads 1.00

Author: coryking [Info]

Description:

This is the content delivery box for the Ad Manager. Download adman_admin and you'll get an idea of what this is all about.

Box Code:


my $content;

my $adman_name = $ARGS[0];

return if($S->have_perm('no_ads'));
return "What position name should I serve good sir?" unless($adman_name);
my $qan = $S->{DBH}->quote($adman_name);

# okay good sir...
# this algorithm for figuring out what to show next is stolen from scoops original ad code
# man... so simple, yet so elegant...

# however, if three joins are looking kind of scary to you, you might want to get
# a new database
my ($rv, $sth) = $S->db_select({
WHAT=>'ac.content_reg, ac.content_anon, apc.id',
FROM=>'adman_content ac, adman_position_content apc, adman_positions ap',
WHERE=>"ap.name=$qan AND apc.adman_position_id=ap.adman_position_id AND apc.adman_content_id=ac.adman_content_id AND apc.enabled=1",
ORDER_BY=>"apc.last_seen asc",
LIMIT=>1,
});

my $ad = $sth->fetchrow_hashref();

# now, I (cory) have found that registered users dont click on the same types of ads that anonymous people do.
# my hunch is that for content specific sites (like a site for photographers,) adsense does a poor job of targeting
# I suspect that anon users hitting a site are more likely to click on the ads targeted at the content
# (like a story about their trip to hawaii, which generates a bunch of ads for hawaiian trips.)
# on the other hand, registered users will probably click on nothing but ads for camera gear.
#
# THIS theory is why I've set the code to dish seperate ads for registered and anonymous users...

my $content;
if($S->{UID} == -1)
{
$content = $$ad{content_anon};
} else {
$content = $$ad{content_reg};
}

# update our impressions and update the last seen for the next go-around
$S->db_update({
WHAT=>'adman_position_content',
SET=>'impressions = impressions + 1, last_seen=NOW()',
WHERE=>"id=$$ad{id}"
});

return $content;
Display: Sort:
Menu
· create account
· faq
· search
· report bugs
· Scoop Administrators Guide
· Scoop Box Exchange

Scoop Site Scroller: Get one yourself!
Smokedot
It's 4:19... do you know where your bong is?

Login
Make a new account
Username:
Password:

Hosted by ScoopHost.com Powered by Scoop
All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest © 1999 The Management

create account | faq | search