News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

AdSense ad within and directly below content of first post in each thread - How?

Started by css_script_writer, July 17, 2010, 11:32:12 AM

Previous topic - Next topic

css_script_writer

Hi everyone

Is it possible to have a small, rectangular adsense ad appear within and directly beneath the content of the first post in each thread?. The idea would be to allow adsense to pick up on keywords within each initial post and produce relevant results so that even if your site was about "cars" if someone created a post about sugar cookies, food ads would start appearing in the initial post of that particular thread.

Ideally, the ad would be aligned to the left and on the same line as the "Report to Moderator" link.

Could someone please tell me what file I would need to edit and where the ad code should go to accomplish this?. I'd like to do this manually rather than using a management MOD.

Thanks so much, CSS
Anxiety Zone Forums & Chat Rooms
http://www.anxietyzone.com/index.php

ɔɔɔɔɔɔuɥoɾ

Their is a mod which add the ad inside the post already, I'm un-sure where inside the post, but I'm guessing it could be moved around if its not at the bottom already.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

css_script_writer

Thanks for the quick reply :)

Like I said, I'd really rather not use a management MOD (I prefer to add the code myself). Having said that, there must be some place in some file where the code can be added. I'm just not sure which file or where in that file the code should be added. Anyone here know?.

- Thanks, CSS
Anxiety Zone Forums & Chat Rooms
http://www.anxietyzone.com/index.php

ɔɔɔɔɔɔuɥoɾ

Quote from: css_script_writer on July 17, 2010, 11:45:19 AM
Thanks for the quick reply :)

Like I said, I'd really rather not use a management MOD (I prefer to add the code myself). Having said that, there must be some place in some file where the code can be added. I'm just not sure which file or where in that file the code should be added. Anyone here know?.

- Thanks, CSS

Well the mod I'm talking about is a very small mod, not the big "Ad-Management" mod, anyway you could just manually install it if it makes you feel any better lol.

If you have some basic PHP skills (like me, just basic) you could mess with the code a little bit and place it as you need.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

css_script_writer

Actually, all I need is...

1) Name and location of file to edit.
2) Specific location within file to insert adsense code to achieve desired result.

I don't want to sound ungrateful and I appreciate your suggestion but honestly, I'd really rather not use any type of MOD for this.

Thanks again, CSS
Anxiety Zone Forums & Chat Rooms
http://www.anxietyzone.com/index.php

ɔɔɔɔɔɔuɥoɾ

OK, that's cool.. (a lot of people like to custom code their own forums)


OK this is the information we need to get started..

Which SMF version are you using?

Do you want the ads in the 1st post only or all replies too? Re-Read, got that one..


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

css_script_writer

SMF v2.0 (RC3) with the default theme. My ads are the size of your RapidShare banner but in my case, I would like them to appear just above the lower horizontal line and within the initial post.
Anxiety Zone Forums & Chat Rooms
http://www.anxietyzone.com/index.php

ɔɔɔɔɔɔuɥoɾ

OK here is what you do.


Open and backup Display.template.php.

Code (Find) Select

// Show "� Last Edit: Time by Person �" if this post was edited.


Code (Add After) Select

        if ($context['first_message']==$message['id'])
echo'

You ad code here

';


See how that works for you, be sure to reply back :)

EDIT:

anything inside that echo will be styled with the class


</div>
<div class="moderatorbar">
<div class="smalltext modified" id="modified_', $message['id'], '">';


If you want to use another style, you will start the echo with a closing div "</div>"

you will have to open a div with the moderatorbar class again after your content though.

But just using the moderatorbar class will make your ads on the left as you wish anyway.


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

css_script_writer

I just wanted to give you a HUGE Thank You!. This was the "Holy Grail" of getting relevant ads to show based on content and at least from what I saw of the code you provide, it has done the trick. A few ads were not relevant but most were right on target :D .

Just curious...lets say you have a forum about cars but since cars are a niche and will only attract ads relevant to cars you miss out on other ads that car enthusiasts might also be interested in. I'm sure car owners also like chocolate cake and furry kittens and vacations to Paris, etc. How do you get a variety of ads (even ones outside your specific niche) to display?.

I'm imagining in your car forum, you would need to create additional boards like "Chocolate Cake Lovers" or "Furry Kitten Fans" in order to begin showing ads outside of your site's main niche.

Your thoughts on this?.

- Thanks again!, CSS
Anxiety Zone Forums & Chat Rooms
http://www.anxietyzone.com/index.php

ɔɔɔɔɔɔuɥoɾ

That's all SEO stuff, you can find information on that (better information that I could provide) by Googling SEO optimization and seeing what you can do.

Placing the ads inside the post will make a major difference for ad targeting, its probably enough for your ads to be more reliant, but do look up SEO :)

Would you consider this issue solved, Click the Mark Topic Solved button on the left :)


SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

css_script_writer

Anxiety Zone Forums & Chat Rooms
http://www.anxietyzone.com/index.php

ɔɔɔɔɔɔuɥoɾ



SMF 2.0 RC5

   
Webhost to New Webhost file transfer service, PM me - Fast transfers

Advertisement: