Love is the best guide to chose right from wrong
Advertise on this site  
Read and enjoy hundreds of helpful earlier posts by categories:
My Love Love Secrets of Love Help Internet SEO Linux admin Funny jokes Fun Kriya Yoga Christmas Editors pick
Philippines Cambodia Business solutions Alternate lifestyle Life and death Politics and God Chat
Deutschsprachige Posts zu folgenden Kategorien:
Liebe Weihnachten Reisen
Anteriores artículos de blog en español:
Dios y amor
Google
 

[Internet]Received Thu, 15 Feb 2007 18:24:48 PHT

Adsense SSI using PHP - manage your advertisement-codes without an ad-server - a few lines of code make your adsense control a whole lot easier

Managing your advertisement-codes from adsense, YPN or any other source can be cumbersome and and difficult to control in a precise way that allows feedback when to change where the code without having to change all the pages.

CMS system are much easier - often ads are managed by a module or at least all you may need to do is to modify a few templates to change thousands of pages.

My site of thousands of pages, forums, blog, gallery and hand coded flat files is far more complex and a change of ads, formats, etc often takes up to a few hundred hours.

The need for an adserver was obvious - openads might be the best choice

A few weeks ago I installed openads ad-server on my site. Hours into studying the configuration I realized that there are some essential improvements possible. The code produced by openads would be equal or greater to the adsense code that would be replaced by the ad-server code. That makes a huge bunch of javascript code - javascript code quiet often tends to break the validation of the entire HTML code.

Many reasons to add a new version of ad-management:

  1. make pages smaller
  2. avoid breaking of page code validation
  3. easier advertisement code control even when using an adserver
  4. in most cases an adserver may become obsolete - making your life much easier
  5. modify inserted ads - adsense, YPN, banners or other ad-code outside your actual text - into one file to replace at once all ads on any number of pages.

Openads still is inactive on my site - but with just a few small lines of simple code I have regained full control of all ads, ad-formats and ad-colors. changing the ad-code an entire section of my site now takes but seconds. even easier than on any CMS.

Here the logic and physics behind my SSI "system":

Instead of the actual ad code - adsense or ad-server code - I insert at the proper location one of several prepared multipurpose PHP SSI code snippets. Upon page-load by a surfer, an SSI included on each page placement where you wish to have ads displayed will then load the actual ad-code whatever and whoever the source of your ad-campaign is. This is in full compliance with common TOS specially Google TOS because you use original adsense code. The original adsense code or any oder code is in its fullest integrity secured / saved into a small text file that is loaded by the SSI procedure.

The legal stuff about SSI of Google adsense has been addressed by me to Google in an official enquiry regarding a same situation but using SSI to change codes with different colors using perl. You may find the Perl SSI description and my formal request for clarification by Google as well as Google's formal reply to me by eMail.

What are the reasons to change ads and hence what is the need for SSI implementation of ads ?

As outline in an earlier article - you have up to 3 Google adsense units plus one link unit per page. Having more ad-units than strong business bidding for your space will let drop the eCPM into basement. In addition and specially if you are a novice - you may want to experiment with different color settings in ads, different formats on same page placements but even more importantly the successful 3 formats as published by Google may change suddenly and make a full site upgrade necessary. For example earlier last year we still had the leaderboard format among the 3 successful formats - most site owners used that format in the top-center above the fold ( ATF ) - most of these site-owner still have these leaderboards all over their sites ... yet since a while Google successfully tests video ads - specially medium rectangle and large rectangle ads in formats 336x280 and 300x250 ATF. Hence strong business go progressive to increase success and always use the single most effective ad method and ad format. This change in successful formats made it necessary for me to change in a hundreds hours lasting work file by file manually ... just to end up with the new SSI system.

The need for changing ad placement, ad format, ad colors and advertiser are:

  1. ability to adapt instantly to changes in advertising industry
  2. ability to adapt to seasonal requirements by advertising industry
  3. ability to respond to a reduced advertiser number during certain hours of day or weekdays to maintain a high eCPM on your ads displayed and to keep out the cheap MFA ads that start to appear if eCPM is below a certain limit
  4. ability to test different formats at a given page placement to test cost-efficiency of various ads and various advertisers
  5. ability to change or remove any ad without touching the content page itself
  6. ability to create offline reading versions of your content without loading javascript ads into the offline versions of your content pages - PHP SSI code remains "silent" without server without creating any empty space on previous ad-placement
  7. ability to implement an adserver more easily with this setup
  8. keep the content pages clean of any javascript of foreign active code and have all active javascript code moved to an external folder-structure
  9. ability to sell a site or change site ownership without having to change all content pages - new owner only needs to replace the ad-code folders with his advertisements - a matter of minutes for an entire site

Where are the most successful page placements for your ads?

based on my extensive and successful research on all sections of the Cyberspace Ashram shows very clearly the following clear top placements and formats:

  1. top-center of page - ATF - above the fold with a 336x280 rectangle enabled for text and images ( hence also video ). this placement and format if used in the correct color may earn you up to 90% of total page revenue - hence by far more than any other ad-format or ad-placement. Next in line of successful formats are almost equal ... the 2 remaining formats.
  2. Wide skyscraper 160x600 - top-left placement, if used on CMS, then clearly much better if placed above navigation bar. See example my blog - this page left side - or my photo gallery.
  3. medium rectangle - 300x250 - below the fold top-center - usually placed below the H1-page title.
  4. A horizontal link unit all the way on top of the page - link color blue

The most successful page placements appear to always be the same on all my pages or different sections. Hence for now the placement testing is finished - the overall results That gives us maximum 4 code units to be placed on each page. Place your code snippets carefully - consider dimensions, page-layout, CSS stylesheets used and make sure none of the displayed advertisement is obstructed by other components of your page nor does any of the advertisements obstruct your actual page content.

Look into my entire web site - the Cyberspace Ashram - and see yourself how I place the ad unites in various sections from static files, forums, gallery, wallpapers, LoveCards, Philippine travel guide, this blog and other pages. I have invested many hundreds hours during the past 15 months to study, test and verify the results by exactly studying all feedback from all 200 ad-channels i have active. You may safely assume that I have optimized to the near maximum - near maximum because everything can be further improved -. infinitely !! But comparing my own web publisher success from SERPS, to traffic to adsense revenue - I know that I am far far above industry average. There might be other or better methods - you may try anything you think is good - but always keep in mind that the success of an entire site is the result of ALL factors being optimized - all factors means:
  1. a loving audience
  2. a loving content
  3. bright friendly colors of the entire site - colors that appeal to the heart and soul
  4. maximum SEO
  5. content that satisfies the need of large groups of readers to attract as many as can benefit from your published articles, products or services
  6. optimized ad colors
  7. optimized ad placements
  8. optimized ad formats
  9. best choice of advertisers

Learn to understand how your SSI and CSS defined tags will display the ad-units

at the exact location where you place the SSI codes - your apache server will display the content of the file you link in the SSI - in our case the file contains nothing else but the Google Adsense javascript code.

In the included file you have:

  1. the code, text or banner code to be displayed at the page-placement where you put your SSI code
  2. around a.m. text or code to include, you place any and all formatting tags - such as center, left or right in proper HTML-code form as defined in your CSS stylesheets - further down I'll give you precise CSS examples ready for copy and paste into your existing external CSS files!

Why all formating in the include file and NOT in the content page ?

if you have an empty div tag in a page - then you get several pixels of empty space around that empty div tag - hence if for example you want to completely remove an entire ad unite and would have all formatting tags on the content page - then you have a distorted text module or page layout!

Now here below we have the 4 lines of code I insert at proper placements on my pages. almost all pages now are converted that way - a few may still need to be upgraded.

Let's analyze an example to make sure you understand the lines

include() let's you include any file - you also could use readfile() the content in () is the URL to the file or content you want to include between single quotes 'URL here'

as URL you can use relative paths or as shown below absolute paths - I prefer absolute paths so far for the simple reason that with the absolute path I never have to figure out in what subdirectory level I insert and use the SSI. It makes my life easier - and that is an important factor. Do only what facilitates your life, work and success and drop all the bothering part of life.

Since we use PHP SSI the base structure is

<?php include(); ?>

my complete lines is below - just replace the neutral file-names with your file-name and adjust the URL to your own server's need - each of below lines 1-4 is ONE line of code without the preceding number !!

  1. <?php include('http://www.your_site-com/folder_to_your_ads/folder1/links_folder1_top_center.tpl'); ?>
  2. <?php include('http://www.your_site-com/folder_to_your_ads/folder1/folder1_ATF.tpl'); ?>
  3. <?php include('http://www.your_site-com/folder_to_your_ads/folder1/folder1_top_center.tpl'); ?>
  4. <?php include('http://www.your_site-com/folder_to_your_ads/folder1/folder1_top_left_160x600.tpl'); ?>

above example 1 - shows the file links_folder1_top_center.tpl that is the file that contains the Adsense code for an Adsense link-unit.

above example 2 - shows the file folder1_ATF.tpl is the file where I place my ATF code - ATF= above the fold - I create groups of code named by the folder where I have my various site-sections separated by topic. we NEED topics and channels to make our system more advertiser friendly - more about channels in a future article!

my naming system is clear enough for me to always instantly see from the file-name what kind of code that SSI-included file contains and to what topic/channel the code belongs.

I have created in my "folder_to_your_ads" - section an entire folder structure equal or nearly equal to the content section of my site - to have an instant reference where the ad-codes for a particular subfolder of my web site i. with hundreds folders in an ever growing publishing system with thousands of hand created content-files such an ad-folder-structure makes sense and is necessary for instant visual reference when I make changes in codes displayed.

Of course you could implement a comparable system in static HTML files using perl CGI - SSI as described in another howto!

CSS for my adsense units - here a few precise examples I use

I use div tags around each ad-code - said inside the included .tpl - files NOT inside the content files. here below the correct CSS syntax I use - ready for copy and paste into your own external CSS stylesheet.

div.left {
float : left;
width : auto;
margin: 2em;
margin-left: 0em;
}

div.center {
text-align: center;
margin: 1em;
color: #00cc00;
color: #993399;
}

div.right {
float : right;
width : auto;
margin: 2em;
margin-right: 0em;
}

For now above should be complete and clear - happy publishing!

Previous posts and follow-up articles on successful web publishing

More soon - to read all follow ups and previous articles of this free online web publisher tutorial just read the posts published in the topic category Internet - see top of my blog - to find previous articles around search engine optimization - see topic SEO and to read more about being successful in general view the topic Love - as love is the key to success in work. Work is nothing else but the expression of love toward a wider audience, or even toward all.

Love and bliss

hans

Home

Kriya Yoga, God and Love = Cyberspace Ashram

Internet Blogs - Blog Top Sites Religion blogs Internet Blogs Blog Submission Blog Top List Love