News:

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

Main Menu

Google AdSense in SMF, various positions...

Started by Moonray, September 25, 2005, 11:46:56 PM

Previous topic - Next topic

simonedifulvio

#361
Hello everyone. thanks for the post!

I have a problem to add adsense after first post.

Not working and this error   www. cronoscalatestoriche.it/log/forum/index.php?topic=2.0

help? thank you very much

sorry for my english i'm italian


this is my code


// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']))
echo '
<hr width="100%" size="1" class="hrcolor" />
<div class="signature">', $message['member']['signature'], '</div>';

echo '
</td>
</tr>
</table>
</td></tr>
</table>
</td></tr>';

   if ($message['id'] == $context['first_message'])
         echo'
         <div align="center">
   <script type="text/javascript"><!--
google_ad_client = "pub-0000000000";
/* 728x90, creato 05/01/11 */
google_ad_slot = "00000000";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>        </div>
         ';
}

azzuhro

_http:hxxp:www.azzuhro-forum.tk [nonactive]

I successfully edit the theme

Display.template.php

echo '
<tr> <td style="padding: 0 0 1px 0;"> </ td> </ tr> <center> <script>
ADS HERE
</ table>
<a name="lastPost"> </ a> ';


example _http:hxxp:www.azzuhro-forum.tk [nonactive]

sojmanie

I have tried everything ad manager as well as manually.Nothing seems to work .Is there something I am doing wrong??Please help!!!!!1

spikespiegel

#364
I've been creating courage to register in this forum, you know, I was a little bored and too lazy to do that.

So let's go to the point, I made a modification in the code, I also tried to use the index code, but it broke my template, I didn't mind about it anyway, cause header ads takes too much space.

Here goes my modification in case if you want to display one ad after the first signature and another one right before the reply button (For curve Themplate - SMF 2.0.1):

Open the file Display.template.php.


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

With:
if ($ad = ($message['id'] == $context['first_message']))

Right after add:
<div align="center">
        <script type="text/javascript"><!--
        google_ad_client = " AdsenseID";
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_type = "image";
        google_ad_channel =" ChannelID";
        google_color_border = "577494";
        google_color_bg = "577494";
        google_color_link = "FFFFFF";
        google_color_url = "999999";
        google_color_text = "EFEFEF";
        //--></script>
        <script type="text/javascript"
          src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
  </div>
';









Right before // Show the page index... "Pages: [1]".
insert:
if ($ad)


{
echo '<!-- Blank -->';
} else {


echo '
<div align="center">
        <script type="text/javascript"><!--
        google_ad_client = " AdsenseID";
        google_ad_width = 728;
        google_ad_height = 90;
        google_ad_format = "728x90_as";
        google_ad_type = "image";
        google_ad_channel =" ChannelID";
        google_color_border = "577494";
        google_color_bg = "577494";
        google_color_link = "FFFFFF";
        google_color_url = "999999";
        google_color_text = "EFEFEF";
        //--></script>
        <script type="text/javascript"
          src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
        </script>
  </div>
';



}






Don't forget to change your Adsense ID and ChannelID, that should work just fine. You can see it working here: forum.mghospedagem.com


PS: I took the whole daybreak and part of the morning to figure out how to solve the issue that when a topic had only one message, it was showing two ads, now you can rest in peace, because if the topic has only one message, it'll only display one ad.


PS 2: SOooooooooooooooo sorry, there was a part missing, just fixed it.

Você que tem um site, seja um blog, fórum, portal, etc., faça parte da nossa Rede social de webmasters. Aqui você poderá divulgar seu site gratuitamente e também poderá conhecer outras pessoas.

Você também poderá baixar Templates para blogger gratuitamente.

lawnkhan

eai galera tem um  forum smf que está com mais de 100.000 membro ....gostaria de saber se isso seria um bug, virus ou coisa parecida ....

o forum está em

hxxp:canallitoral.com.br/index.php [nonactive]

agradeço se alguém puder me dar uma dica de como colocar adsence , pois fui tentar e quase perdi tudo o forum

Valeu um salve aqui do BRAZIL  4YOU

spikespiegel

Quote from: lawnkhan on October 05, 2011, 07:51:05 PM
eai galera tem um  forum smf que está com mais de 100.000 membro ....gostaria de saber se isso seria um bug, virus ou coisa parecida ....

o forum está em

canallitoral.com.br/index.php

agradeço se alguém puder me dar uma dica de como colocar adsence , pois fui tentar e quase perdi tudo o forum

Valeu um salve aqui do BRAZIL  4YOU


Vc deu foi sorte de ter um brasileiro lendo sua mensagem, pq vc ta no fórum americano.

Fiz uma alteração do código deste topico, se quiser te ensino como instalá-la.


Isso se você não for um bot fazendo SPAM.

Você que tem um site, seja um blog, fórum, portal, etc., faça parte da nossa Rede social de webmasters. Aqui você poderá divulgar seu site gratuitamente e também poderá conhecer outras pessoas.

Você também poderá baixar Templates para blogger gratuitamente.

lawnkhan

Salve Brasil qblza ...meu gostaria sim de uma ajuda tenho ha um tempinho e nunca usei e ele ta chapado de membro americanos rssrs
o pior é que deve ser virus   .......tem mais de 110k de membros
ai eu gostaria de colocar adsense pra ver se funfa ..
vc é de onde???     eu sou de osasco , são sebastião São Paulo ....... valeu grande abraço..

spikespiegel

Quote from: lawnkhan on October 05, 2011, 10:44:21 PM
Salve Brasil qblza ...meu gostaria sim de uma ajuda tenho ha um tempinho e nunca usei e ele ta chapado de membro americanos rssrs
o pior é que deve ser virus   .......tem mais de 110k de membros
ai eu gostaria de colocar adsense pra ver se funfa ..
vc é de onde???     eu sou de osasco , são sebastião São Paulo ....... valeu grande abraço..

Goiânia, mg, goiania, por aí.
te mandar meu msn por mensagem pessoal.

Você que tem um site, seja um blog, fórum, portal, etc., faça parte da nossa Rede social de webmasters. Aqui você poderá divulgar seu site gratuitamente e também poderá conhecer outras pessoas.

Você também poderá baixar Templates para blogger gratuitamente.

fmiyar

thank.
it works now on my new forum website big family (mbahmarto-family[dot]com)

piranon


bukharifaran

Hi,

I've tried to add the google ad code in first Post. Though my Display.template.php file code is bit different from the code which is provided by topic initiator, but I've successfully added the code with a little variation.

The area of Display.template.php file was mentioned by topic initiator had a different code, my code at that place was as follow:

// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
<div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';

echo '
</div>
</div>
<span class="botslice"><span></span></span>
</div>
<hr class="post_separator" />';
}


I have added the code provided by topic initiator after replacing my adsense code after:

// Show the member's signature?
if (!empty($message['member']['signature']) && empty($options['show_no_signatures']) && $context['signature_enabled'])
echo '
<div class="signature" id="msg_', $message['id'], '_signature">', $message['member']['signature'], '</div>';


So if anyone have different code in Display.template.php file and it matches with the code I've provided above, he can add his google ad code after above lines which I've mentioned.

Here you can see the result.
http://www.mobilefun.pk/forum/topic-9.0.html
My Forum: Mobile Fun | My Blog: Mobile Fun Blog

bukharifaran

After adding the google code in First post of each topic as described by the topic initiator, I've also added the google ad code on the second place. Just below the Main menu as we have on SMF http://www.simplemachines.org/community/index.php

Topi initiator mention index.template.php file to edit. But he is using some different theme. Where as I am using default theme. By adding the code provided by topic initiator, it creates some table and other links along with google ad which looks bad.

Topic initiator give this line to search:
// The main content should go here. (Some more text was there in initial posts but that text is not in default theme.)

Topic initiator mention to add his provided code below above mentioned line.

But if you are using default template than right below this line, you will find this code:


echo '
<div id="content_section"><div class="frame">
<div id="main_content_section">';

// Custom banners and shoutboxes should be placed here, before the linktree.


I have added my Google code right after the second dive having id="main_content_section" and it works fine for me. You have to add like this:


echo '
<div id="content_section"><div class="frame">
<div id="main_content_section">

Your Google Ad code here
';

// Custom banners and shoutboxes should be placed here, before the linktree.


And it will work for you.

:)
My Forum: Mobile Fun | My Blog: Mobile Fun Blog

Hj Ahmad Rasyid Hj Ismail

The OP was created long time ago bukharifaran. Don't expect the code will remain the same. :P

bukharifaran

Quote from: No More Mr Nice Sully on October 22, 2012, 07:47:30 PM
The OP was created long time ago bukharifaran. Don't expect the code will remain the same. :P

I know that there will be many users like me who are new and they might have the exact code that I have. So my post can help them in selecting a right place to insert the code.

When I ask from support how to add google ads, they told me to browse the TIPS and Tricks category. I open this and found this thread. And I see some posts where users are complaining that there code is different from the one provided in first post. That is why I posted the new code which I have.
My Forum: Mobile Fun | My Blog: Mobile Fun Blog

Hj Ahmad Rasyid Hj Ismail

Sorry but IMO you were not reading the newer advices inside this topic and others. There are members who already given newer tips and tricks. Yours will later be similar to theirs when your post is hidden by various other post after yours.  :P

ryan_dwight

any updated code for this on black n black theme?

thanks

rajpbm

my all postiong seems to be good but still i am not getting good CTR on google adsense
now tell me what to do ?
my CTR rate still less then 1  :(

TheListener

Quote from: rajpbm on June 12, 2013, 04:04:36 PM
my all postiong seems to be good but still i am not getting good CTR on google adsense
now tell me what to do ?
my CTR rate still less then 1  :(

How old is your forum?

Techhub

Quote from: trenchteam on September 27, 2005, 07:43:01 AM
nice work! The codes work fantastic!  I get about 20,000 impressions a day on my site. It has skyrocketed my google ad clicks using your code! hehe ;D  ten bucks a day is great for paying for my host! ;D

Advertisement: