Gossamer Forum
Home : Products : Links 2.0 : Customization :

Target banners to search word(s)..Here`s how..

Quote Reply
Target banners to search word(s)..Here`s how..
This is a very simple mod for non-templates users of which I am one, unfortunately I have no experience with templates but I`m sure a kind template user will post how to make it work with that format.

I`m using WebAdverts version 2.02, this mod enables you to display a particular advertising banner on your search results page when a specific search term is used.

You can have multiple accounts for a single search term and have multiple search terms per account.

If a search term is not found to be relative to any accounts the default banner will be displayed.

This will not currently work with multiple word searches (defualt banner is shown instead).

Heres how..

in file: site_html.pl
in: sub site_html_search_results

under where it says
Code:
my $term = &urlencode ($in{'query'});

place this
Code:
my $searchterm = ($in{'query'});

Now you can use $searchterm wherever you want within the search results page and print the "search term" (will be used later to call the applicable banner)

Next..

in file: site_html.pl
in: sub site_html_search_results

Place your banner call within the search results page wherever you want the banner displayed (I used IMG tags because I dont use SSI)

Code:
<a href="http://your_path_to_webads/ads.pl?banner=NonSSI;page=$time;zone=$searchterm">
<img src="http://your_path_to_webads/ads.pl?page=$time;zone=$searchterm" border="0"></a>

Next..

in: WebAdverts
in file: ads.pl

setup as usual and do two things

where it says $advertzone = ""; leave it without a zone.

where it says $DefaultBanner = ""; put defualt in here or whatever you wish to call your "default" account
(this accounts banners are shown when search terms are not matched to a zone)

Next..

in:WebAdverts

Setup a new banner account, this will be the default account, name the account in the Name field (above the E-Mail field) default or whatever you defined in ads.pl, fill in the rest as usual but define the zone for this account with something random like "ghjeondmtybfj" why do this? because this is effectively the zone this account applies to and the chances of that being a search term are slim so it will only display when no other accounts cover the search term used
(you can of course make a normal banner account the default and have it displayed with search terms as well as being the default, just name it in $DefaultBanner in ads.pl)

Setup a new banner account, define the zones for this new account with the search terms you want to display its banners with i.e. if you want this banner to show with the search term "computers" enter in the field Zone(s): computers

If you want that banner shown with various search terms just keep adding them to its zone list (make sure you seperate them with a space i.e. computers computer modems monitor etc etc etc..

Different accounts can also rotate through the same search term.

And of course accounts all have the usual WebAdverts features.

Next..
install one of the keyword tracker mods.

Now you can sell your top search terms :-)

chmod
Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
doesn't that mean you would have to search under a one word query? Smile

you should do something else.. like

if ($query =~ /computers/) {
&zone('computers');
}

Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
Hi Widgetz,
yeah, above I pointed this out

This will not currently work with multiple word searches (defualt banner is shown instead).

I`m checking out your code right now.
chmod

Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
i made this mod when this message board was using wwwthreads.. or whatever that board was..

i plan on making another one as soon as i get to it.. this time for links 2.0

that mod will be links' own advertisement manager.. although the code will mostly be webadverts.. Smile

jerry
Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
It would be better to have the keywords built into an array and then say if any of the terms in that array are queried then print the banner/zone for that array or keywords.

You could even add fields to the adverts setup to allow advertisers to add in their keywords and then use that file to build the array of keywords for that zone.
Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
widgetz

where can I find larger information on using WebAdverts and links?
Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
I'm using templates...

I am wondering if there is a way to have different results templates files for the keywords?

for example, I search for the word "dog", the script could return the results using the "dogsearchresults.html template" in which I could specify specific advertising in etc.

Maybe there is a simpler way to display banners by keywords? FYI, I am using CentralAD for my advertising.

Thanks

Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
Any luck with templates or multi-term searches?

Thanks very much.

Quote Reply
Re: Target banners to search word(s)..Here`s how.. In reply to
If someone is using this mod with templates please let me know, cause i'm really confused by these 5-6 threads working on mods like this.