Google AdSense has implemented new Google AdSense ad code with the new AdSense As Management feature. With the new style of ad code and Manage Ads tab, the configuration settings for an AdSense ad unit such as ad size, colors, and channel settings are stored on Google servers, so that in future, any changes to Google AdSense units can be made from within the account instead of having to modify the ad code.
With the new Google AdSense Ad Management system, the new generation ad code is considerably shorten and simplified. Gone are the google_ad_format, google_ad_type, google_ad_channel, google_color_border and etc, and been replaced with google_ad_slot, which points to corresponding ad unit as saved in publisher’s account.
However, the new Google AdSense ad code is not necessary suit all. It’s very hard to implement for blogs or websites that adopt the revenue sharing business model, where Google AdSense ad code of different writers and authors are used in rotation. It’s even harder if custom channel ID number is used to track the performance of the ad unit in AdSense revenue sharing program.
The legacy old classic Google AdSense ad code no longer able to be generated from Google AdSense Setup page. However, the legacy code is still been supported, and continue to can be used in web pages. For webmasters who still want to use the legacy AdSense ad unit code, use the following guide to generate the ad code manually.
Format of Legacy Old Google AdSense Ad Code
Both text ads, image ads, video ads, and link units use the similar ad code format as below:
google_ad_client = “pub-XXXXXXXXXXXXXXXX”;
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = “300x250_as”;
google_ad_type = “text_image”;
google_alternate_ad_url = “http://www.mydigitallife.info/”
//2007-07-25: My Digital Life
google_ad_channel = “XXXXXXXXXX”;
google_color_border = “FFFFFF”;
google_color_bg = “FFFFFF”;
google_color_link = “0000FF”;
google_color_text = “000000”;
google_color_url = “005577”;
google_ad_client – The publisher ID that is required and must be correct to get paid and earn revenue from Google AdSense program when eligible clicks or page views occurred.. The publisher ID can be retrieved from Google AdSense account.
google_ad_width, google_ad_height, google_ad_format – Define the size and format of AdSense ad unit to display. All there values should be matching each other, i.e. the first number before ‘x’in google_ad_format is also google_ad_wide, and the second number after ‘x’ before ‘_’ is the google_ad_height. google_ad_height and google_ad_width have no effect on the actual ad size as they only control the object box within which the ad unit is contained. The parameters are used normally to maintain a consistent layout presentation when the page layout provides an area that is wider than the ad unit itself. Google provides 24 different ad formats (12 ad units and 12 link units) for web page placement.
Normal Ad Unit:
234×60_as (Half Banner)
160×600_as (Wide Skyscraper)
180×150_as (Small Rectangle)
120×240_as (Vertical Banner)
200×200_as (Small Square)
336×280_as (Large Rectangle)
120x90_0ads_al (4 links)
120x90_0ads_al_s (5 links)
160x90_0ads_al (4 links)
160x90_0ads_al_s (5 links)
180x90_0ads_al (4 links)
180x90_0ads_al_s (5 links)
200x90_0ads_al (4 links)
200x90_0ads_al_s (5 links)
468x15_0ads_al (4 links)
468x15_0ads_al_s (5 links)
728x15_0ads_al (4 links)
728x15_0ads_al_s (5 links)
google_ad_type – Definite if only text ads, images ads or both type of ads is allowed. Note that for Flash based ads and video ads to appear, image ads must be enabled. Available options are:
text – for AdSense text ads only
image – for image ads only, including video ads and Flash ads.
text_image – for text and image ads
google_alternate_ad_url – Display another ads or web pages when Google AdSense program does not have a relevant advertisement for the ad slot. By default, a public service ad is display. Specifying the alternate ad URL will display the content specified in the URL. Note that the alternative ad code should be specified in HTML file, and should not has size that bigger than the Google ad unit, or else the alternative ad will be cut off or trimmed off. It’s also possible to put in an alternate URL which will collapse the ad space (no space been used for the ad).
google_ad_channel – To specify a custom channel (a 10 digits number) to track ad performance and statistics. Channel ID must be created at AdSense account before they can be used.
google_color_border, google_color_bg, google_color_link, google_color_text, google_color_url – Determines the color of the ad border, ad background, ad title of each ad, ad text inside the ad block, and URL at bottom of each ad. Up to 4 separate values (differentiated by commas) can be supplied for automatic color rotation when the ad is served by the Google server. The image ads does not affect by these values. Note that the color value should be converted in hexadecimal format.