Easy Google Ads insertion

Started by cypdevil, January 06, 2011, 05:05:15 AM

Previous topic - Next topic

cypdevil

Playing around with various suggestions that have been proposed here and elsewhere, I've simplified inserting Google Ads to SMF 1.1.12 by adding the following script lines to the index.template.php file of your preferred theme, in the place indicated by the lines before // Add Google Ads and after // display user name.

if (empty($settings['header_logo_url']))
echo '
<span style="font-family: Verdana, sans-serif; font-size: 140%; ">', $context['forum_name'], '</span>';
else
echo '
<img src="', $settings['header_logo_url'], '" style="margin: 4px;" alt="', $context['forum_name'], '" />';

echo '
</td>
<td align="right" class="catbg">
<img src="', $settings['images_url'], '/smflogo" style="margin: 2px;" alt="" />
</td>
</tr>
</table>';

// Add Google Ads

echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr>
<td style="padding: 1ex 1px 2ex 1px;" width="100%" valign="top">
<div class="tborder">
<table border="0" width="100%" cellspacing="1" cellpadding="5" height="72">
<tr>
<td  colspan="4" class="catbg" height="18">
<font size="1">Advertisements</font>
</td>
</tr>
<tr class="topicbg1">
<td class="topicbg1" align="center" width="100%">
<script type="text/javascript"><!--
   google_ad_client = "<xxx>";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text";
google_ad_channel = "1234567890";
google_color_border = "009900";
google_color_bg = "EBFFED";
google_color_link = "006600";
google_color_text = "000000";
google_color_url = "0000FF";
google_ui_features = "rc:6";
   //--></script>
    <script type="text/javascript"
      src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
</td>
</table>
</div>';


// display user name
echo '
<table width="100%" cellpadding="0" cellspacing="0" border="0" >
<tr>';

if($context['user']['is_logged'])
echo '
<td class="titlebg2" height="32">
<span style="font-size: 130%;"> ', $txt['hello_member_ndt'], ' <b>', $context['user']['name'] , '</b></span>
</td>';

// display the time


Add your own client # in place of <xxx> and choose your own colours, of course. The channel # is optional, only if you use channels. Note that the lines:
<td  colspan="4" class="catbg" height="18">
<font size="1">Advertisements</font>
</td>
are absolutely mandatory to conform to Google rules; if you miss them out, your account will be closed 'Sponsored Links', instead of 'Advertisements' is also acceptable.

The ads will be shown on every page, including registration. I confirm that this is acceptable to Google. I received the following exchange of e-mails after I was not conforming to their rules for other reasons.
Quote
Hello Brian,

Thanks for following up and for updating your site. I have reviewed
cypenv.org/smf/index.php and can confirm that your implementation of
Google ads on the registration page of your forum is indeed acceptable.

Sincerely,

Ben
The Google AdSense Team

Original Message Follows:
------------------------
From: <deleted>
Subject: Re: Google AdSense Policy Enforcement
Date: Sat, 31 Dec 2005 18:14:18 +0200

I've removed the contentious text and apologise for the inconvenience
caused. I misunderstood your policy which I thought to mean something to
the effect of "Please help us fund this site by clicking on the ad". I
find that it is a very fine line you draw between the non-permitted
"support our sponsors" and the permitted "sponsored links".

I do have one problem and seek your dispensation for it. I've applied
ads to http://www.cypenv.org/smf/index.php. As I understand it, you do
not like ads on the registration/profile pages of forums, but permit it
on the forum pages. I have not found a way of not having the ad on the
registration page yet have it on all the other ones as the header is
common to all pages. The ads that come up on the registration page are
contextual, usually for password management software, so I cannot see
the reason for your objection. Please confirm this is OK.

Regards,

Brian

Google AdSense wrote:
> > Hello,
> >
> > While reviewing your account, we noticed that you are currently
displaying
> > Google ads in a manner that is not compliant with our policies. For
> > instance, we found violations of AdSense policies on pages such as
> > http://www.cypenv.org/Files/cars.htm
> >
> > Publishers are not permitted to encourage users to click on Google ads
or
> > bring excessive attention to ad units. For example, your site cannot
contain
> > phrases such as "click the ads," "support our sponsors," "visit these
> > recommended links," or other similar language that could apply to the
Google
> > ads on your site. Publishers may not use arrows or other symbols to
direct
> > attention to the ads on their sites, and publishers may not label the
Google
> > ads with text other than "sponsored links" or "advertisements."
> >
> > Please make any necessary changes to your web pages in the next 72
hours. We
> > also suggest that you take the time to review our program policies
> > (https://www.google.com/adsense/policies) to ensure that all of your
other
> > pages are in compliance.
> >
> > Once you update your site, we will automatically detect the changes and
ad
> > serving will not be affected. If you choose not to make the changes to
your
> > account within the next three days, your account will remain active but
you
> > will no longer be able to display ads on the site. Please note, however,
> > that we may disable your account if further violations are found in the
> > future.
> >
> > Thank you for your cooperation.
> >
> > Sincerely,
> >
> > The Google AdSense Team

You can see the results at http://www.cypenv.eu/envenergy/eeforum/index.php




Illori

we already have several mods plus tips on installing google ads in the forum. this might be better off in the tips board though. also you might find that people that use other themes may or may not be able to follow your tip here as their index.template.php may be too different then the code you posted here. I am also assuming you want the index.template.php file edited with your code as you dont say which file to edit.

cypdevil

Quote from: Illori on January 06, 2011, 06:10:10 AM
we already have several mods plus tips on installing google ads in the forum. this might be better off in the tips board though. also you might find that people that use other themes may or may not be able to follow your tip here as their index.template.php may be too different then the code you posted here. I am also assuming you want the index.template.php file edited with your code as you dont say which file to edit.

1. I'll copy to the tips board: thanks for the tip.
2. This is tested only with SMF 1.1.12, hence the insertion on this board
3. I've reduced others' suggestions to a minimum and synthesised together the ideas expressed in 4 or 5 proposals,.
4. If the code is put just before '// display user name', I think it will probably work in any theme (obviously, I haven't tested all of them, but it works on Default and Bisdak World Green. I imagine it will work with all themes with an index.template.php and it may work in a number of places within the file, but I put it between the graphics header and the 'Welcome xxx' heading out of choice.)
5. My message states quite clearly the file name to be modified is index.template.php, in the first paragraph, so your assumption is correct.

Imso

Quote from: Illori on January 06, 2011, 06:10:10 AM
we already have several mods plus tips on installing google ads in the forum. this might be better off in the tips board though. also you might find that people that use other themes may or may not be able to follow your tip here as their index.template.php may be too different then the code you posted here. I am also assuming you want the index.template.php file edited with your code as you dont say which file to edit.
WHAT MODS?


stefanie

Thank you, this was really helpful. Mods are really hard to modify for custom themes!

manusaktteva

Really good.
I found it is one of the easy way to insert the Google Ads

travelsense

#7
I do have one problem and seek your dispensation for it. I've applied
ads to another forum software site

mashby

Quote from: travelsense on October 30, 2012, 10:01:51 PM
I do have one problem and seek your dispensation for it. I've applied
ads to another forum software site
I would recommend asking on the support site for vBulletin instead of here.
Always be a little kinder than necessary.
- James M. Barrie

kingston250

I have already know this way to insert Google ads.

nihittuli1


PSPguru

Do you think using one of the free adsense  mods will not help, I'm quite confused  ??? ?

web-tester


Shapewear


gloriafu


Advertisement: