I must say that Adsense and other Pay per Click Companies are one way to get some profit from your site what is very important. But all of us without programing knowledge have problem implementing it and make it to work and to get look that we need. That is reason that I make these small tutorial about adding Google Adsense code to your pages. These tutorial is just for e107 CMS, but could be usefull and others. STEPS:
1. Register gmail account
2. Sign in to Google Adsense
3. Explore Google Adsense Control Panel
4. Getting code:
* ------- Adsense for Content
* ------- Adsense for Search
* ------- Adsense Referrals
5. Implementing - Adsense for Content
6. Implementing - Adsense for Search
7. Implementing - Adsense Referrals
First of all to use Google Adsense advertise code on your site you must make gmail account.
To get one for free you must go to
FREE GMAIL ACCOUNT SIGN IN and input all data that need.
Soon you will find small video instruction HOW TO CREATE GMAIL ACCOUNT ,but still not finished.
After you create GMAIL account you are free to login to Google Adsense - link to Google Adsense main page is
https://www.google.com/adsense/
and add your site. You will wait few days to be approved or not, and if it is we go to next step.
Next step is to get Adsense code, there are 3 possibilities
* Adsense for Content,
* Adsense for Search
* Referrals.
You can find video lesson about Adsense CONTROL PANEL HERE.
After you watch it and understand basic, we start adding Adsense code to your pages. When I make them!!!
There are few ways adding code. First is using SHORTCODE, second is adding to MENU and third is directly adding to news.
The best way is using SHORTCODES in that way you get Adsense code on same place in every news and it is by me best. Why you add once and use all the time without thinking if something go wrong, it is always on same place and working.
ADDING ADSENSE CODE USING SHORTCODE
Adsense code you get is like these sample:
> script type="text/javascript"< > !--
google_ad_client = "HERE IS YOURS ADSENSE ID";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
//news home bottom
google_ad_channel = "ADSENSE CHANNEL";
google_color_border = "FFFFFF";
google_color_bg = "333333";
google_color_link = "E1771E";
google_color_text = "FFFFFF";
google_color_url = "C3D9FF";
//--< > /script< > script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"< > /script<
What you must do next make new file called adsense.sc, sc is extension and if you use Windows OS like XP you must do something to be able to create these file --< go to any folder and on the top ( file menu ) choose Tools-< Folder Options, after that choose View tab and scroll up to Hide extensions for known file types uncheck that and close window. Now you can make adsense.sc.
In adsese.sc file paste these piece of code:
global $globalmode, $style;$ret="> div align='center<
is not necessarily depend if you know HTML, if you not just use theseand you can change value for align to left, right or center. What you need for your layout.
then paste YOUR ADSENSE CODE - like these:
> script type=\"text/javascript\"< > !--
google_ad_client = \"YOUR ID\";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = \"468x60_as\";
google_ad_type = \"text_image\";
//news home bottom
google_ad_channel = \"YOUR CHANNEL\";
google_color_border = \"FFFFFF\";
google_color_bg = \"333333\";
google_color_link = \"E1771E\";
google_color_text = \"FFFFFF\";
google_color_url = \"C3D9FF\";
//--< > /script< > script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"< > /script<
IMPORTANT !!!!
You see that in mine code example that before every " i s added \ -----< \" .
YOU MUST ADD BEFORE ALL " one \ or code will not work. Look carefully don't miss any!!!
and on the end you add these code:
> /div< ";
return $ret;
So your final code look like these:
global $globalmode, $style;$ret="> div align='center< > script type=\"text/javascript\"< > !--
google_ad_client = \"YOUR ID\";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = \"468x60_as\";
google_ad_type = \"text_image\";
//news home bottom
google_ad_channel = \"YOUR CHANNEL\";
google_color_border = \"FFFFFF\";
google_color_bg = \"333333\";
google_color_link = \"E1771E\";
google_color_text = \"FFFFFF\";
google_color_url = \"C3D9FF\";
//--< > /script< > script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\"< > /script< > /div< ";
return $ret;
Save file and upload it to www.yoursite.com/e107_themes/THEME YOU USE FOR SITE/. Or you can just over hosting Control panel make adsense.sc file and add copy code - that depend of you.
IMPORTANT !!!!
adsense SHORTCODE work only with theme you use if you change site theme you must do same for other theme.
Next thing is to register SHORTCODE. To do it must edit theme.php of theme you use. You can find it here:
www.yoursite.com/e107_themes/THEME YOU USE FOR SITE/theme.php
You can download it from your Hosting Control panel and edit on Local Computer, use existing theme.php you have on localhost or edit over Hosting File Manager.
You must add these code to your theme.php at the top of your theme after these code:
if (!defined('e107_INIT')) { exit; }
code you add is:
1.$register_sc[] = 'ADSENSE';
it looks like this:
> ?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvsroot/e107/e107_0.7/e107_themes/interfectus/theme.php,v $
| $Revision: 1.11 $
| $Date: 2007/03/18 11:20:30 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
$register_sc[] = 'ADSENSE';
OK we alomost do all job next thing is to add SHORTCODE where you want. You can use it in few ways:
-you can add it to theme.php to be static
-you can add them into your news....
Adding SHORTCODE means to put these code
1.{ADSENSE}
where ever you put these code Adsense banner will show.
In theme.php you can add it alomost everywhere, but I suggest few places the best place is to add after
1.{NEWSBODY}
code in other row:
1.{NEWSBODY}
2.{ADSENSE}
In that way Adsense will show on every your news on the bottom of your news.
Other place is afrer
1.{WMESSAGE}, {NEWSIMAGE}, {LOGO}, {BANNER}
or before
1.{SITEDISCLAIMER}
all depend of template you use.
You can add in these way more than one SHORTCODES, means that you can by these procedure make SHORTCODES for different Adsense formats. Also if you use AdBrite, Amazon or some other Adverts in these way you can add these shortcode and use it.
IMPORTANT !!!!
When you making new SHORTCODE:
1. name SHORTCODE FILE as you wish but not adsense.sc, you can use any name like no spaces onli you can use is _ !!!
1.adsense_left.sc
2.whatever.sc
3.for_me.sc
2. When adding code to theme use same syntax always UPPERCASE LETTERS !!
1.$register_sc[] = 'ADSENSE_LEFT';
2.$register_sc[] = 'WHATEVER';
3. $register_sc[] = 'FOR_ME';
3. SHORTCOSE YOU ADD WILL BE:
1.{ADSENSE_LEFT}
2.{WHATEVER}
3.{FOR_ME}
I hope these part was useful, you can reister and ask all you do not understand!!!