Section 13.2. Google AdSense

13.2. Google AdSense

Even if you don't have any products to sell, you still have one valuable asset: the attention of your visitors . The good news is there are a huge number of companies ready to pay for it.

Some of these companies pay you a minuscule fee every time someone requests a page that has an ad, while others pay only when an ad is clicked, or when an ad is clicked and the visitor goes on to actually buy something on the sponsor's site. Fortunately, you don't need to waste hours checking out all these options, because Google offers an advertising program that handily beats just about every other system out there.

The program's called Google AdSense, and it requires you to show small, text-only advertisements on your Web site. You sign up, set some space aside on one or more Web pages, and paste in some HTML that Google supplies (see Figure 13-2). Google takes care of the rest, filling in the space with a group of ads every time someone requests the page.

Showing Google AdSense ads doesn't get you anything, but whenever a visitor clicks on one of the ad links, you earn a few cents . When your total reaches $100, Google mails you a check.

Note: There's no way to know for sure how much money an individual click is worth with AdSense. That's because Google advertisers compete by bidding for different keywords (see Section in Chapter 11) and keyword prices can fluctuate over time. Google does let you know how much your clicks were worth (in total) when it pays you. A typical click can net you about 20 cents.

Figure 13-2. In this example, a box with three Google AdSense ads is nestled alongside travel links. It blends into the scenery perfectly with a similar visual style and content. This grouping of ads is sometimes called an ad unit. Google lets you choose the layout of your ads, and the number of them you want to use in a page, so it's up to you whether you want to slip a few ads in quietly or have them dominate your page.

Before you become an AdSense devotee, you need to know what makes AdSense different from other ad programs. Here are some of its top advantages:

  • AdSense ads are relevant . Google automatically scans your site, and matches ads based on keywords. That means that if you've got a Web site devoted to SpongeBob SquarePants, Google will provide ads hawking SpongeBob DVDs, inflatable dolls , and birthday gear. Using keyword-based ads is far, far better than aggravating your visitors with offers for completely unrelated products like high-tech spy cameras . It also dramatically increases the chance that a visitor will click an ad and generate a click-through fee. And if you're worried about a competitor's site turning up in an advertisement, you can tell Google to filter it out.

  • AdSense ads can blend in with the scenery . Google gives you a wide range of ad layout and color options. This ensures that you can generate ads that match the slick color scheme of the rest of your Web site.

  • Google gives fair payment terms . As you learned in Chapter 11, Google charges advertisers different amounts of money for different keywords. Most advertising providers would just swallow the extra money, and pay their members the same amount for any click-through. Not Google. It pays you according to the current value of the keyword, which guarantees that you're always getting a competitive rate.

  • There are no start-up charges . The AdSense program is completely free to join.

Tip: Don't try to cheat AdSense. Devious Web developers have tried to game the system by clicking on their own ads over and over again, or even firing up automating programs that do it for them. The problem is that Google uses various techniques to spot suspicious usage patterns. If it sees a ridiculous number of clicks over a short period of time all originating from the same computer, it's likely to spot the deception and ban your site outright .

13.2.1. Signing Up for AdSense

You can learn much more about the specifics of Google's ad program by surfing to There's also a great, not-too-detailed walkthrough of the AdSense service at

When you're ready to get started, follow these steps to sign up:

  1. On the AdSense homepage, click the Click Here to Apply button .

    Google asks you if you already have an AdWords account (which you can use to pay for advertisements that appear on Google's Web site, as described on Section If you do, you can use that to login and skip the account creation steps.

    Note: Even if you have a Gmail account, you still need to register for AdSense. Gmail login information and the AdSense information are separate, because Google needs a few more details before it can conduct business with you.
  2. To create a new account, you need to supply your email address and a password, and click Continue .

    Google starts the process of getting the account information it needs. First, you'll need to identify whether you're applying as an individual or as a registered business. Registered businesses that are based in the U.S. need an EIN (Employer Identification Number). U.S. citizens who are applying as individuals need to give an SSN (Social Security Number). Citizens of other countries need to apply for a U.S. TIN (Taxpayer Identification Number)see for the lowdown.

  3. Next , you'll need to supply the typical identification information, like your name and address .

    The interesting part comes when it's time to choose the type of AdSense feature you want. You'll find these options in the Products section at the bottom of the page (see Figure 13-3).

    Figure 13-3. Google gives you the option of ordinary AdSense (called "AdSense for content"),. which you've learned about so far, and a search-based feature called "AdSense for search." With "AdSense for search," you can provide a Google search box on your page that visitors can use to search the Web. When ads crop up in the search results, they're treated like ads on your Web site (see Section 13.2.4 for more). You may as well choose both AdSense programs, since you can decide later which to use.

  4. Once you're finished, click Submit .

    The next page shows a summary of all the information you supplied.

  5. Click Continue to finish the process .

    Now you need to wait for Google to contact you by email to confirm your account. There are two steps in this process.

    First, Google sends you an email confirmation message almost immediately. This message contains a link that you need to click to confirm your email address. However, this still doesn't finish the job.

    Instead, someone at Google needs to take a quick look at your Web site to confirm it really exists and isn't promoting illegal activity (for example, offering pirated copies of Windows XP). Once this process is finished (usually two days later), you'll get a second email confirming your account has been activated.

13.2.2. Creating an Ad

Now that you have an AdSense account, you're ready to generate some ads and put them in your Web site. Just go to, and log in with your email and Google password. You'll see the Google AdSense page (see Figure 13-4).

Note: Before you can generate the right ad unit, you need to have a basic idea of where you plan to put your ads. Consider whether you want a vertical or horizontal strip of ads, and try to assess how wide or long that bar should be. You can skip ahead to Figure 13-6 to see a preview of some of your layout options.

Figure 13-4. The AdSense page is divided into several tabs. Initially, you begin at the Reports tab, where you can survey a day-by-day breakdown of the money you've made.

The AdSense page has four central sections, which are represented by tabs at the top of the page. These sections include:

  • Reports . This tab helps you assess the performance of your AdSense ads. You'll see a summary of the money you've made today and over the last week. To get more detailed information, you can click a report link (like "This month, by day," which gets the earnings for this month, totaled by day). Google won't tell you what each individual click was worth, or which particular ad caught the reader's eye. You can also view a payment history that records each check that Google's mailed out to you (click the "View payment history" link).

  • AdSense for Content . This is your starting point for generating AdSense adsit's where you specify the type of ad you want, and get the HTML code you need to insert into your Web pages. You also have access to some advanced features here, such as filtering out ads from specific Web sites.

  • AdSense for Search . Using this tab, you can generate the HTML for a Google search box that you can place on your Web pages. When a visitor performs a search through this Google box, they may see some relevant ads, and if they click one, you'll get the usual commission.

    AdSense Rules

    Google enforces a handful of rules that your Web site must follow in order to be a part of AdSense. Many of these are common sense, but it's still worth taking a quick look at them.

    • You can't put the ads that Google supplies you with in email messages or pop-up windowsthe temptation for spammers to abuse the system is just too great.

    • You can't put ads on pages that don't feature any "real" content. This includes error, login, registration, welcome, and under-construction pages. You definitely can't create pages that include nothing but ads.

    • You can't try to obscure parts of the ad (for example, by placing other elements overtop with a style sheet). The entire content of an ad must be visible.

    • You can't click your own ads. You also can't use programs that do this for you. Finally, you can't entice your visitors to click your links using threats or incentives.

    • Your Web site can't include excessive profanity, copyrighted material, pornography, content about hacking hi-tech security systems, advocacy for illegal drugs, hate speech, or anything related to gambling.

    For the full AdSense policy, surf to

  • My Account . This tab lets you update most of the information you supplied when you registered. This includes details like your mailing address and tax information.

Now that you're acquainted with AdSense, you're ready to dive in and build your first ad unit. Here's how:

  1. On the AdSense page, click the "AdSense for Content" tab .

    The "AdSense for Content" tab has several clickable subcategories , including "Ad layout code," which is selected when you arrive on the "AdSense for Content" page. Using this "Ad layout code" sub-tab, you can generate the HTML code for a Google ad unit.

  2. Choose the type of ad you want to createeither an ad unit or a link unit .

    An ad unit is a group of one or more ads, complete with descriptive text or ( optionally ) images. When a visitor clicks an ad, the visitor winds up at the advertiser's Web site (and you get paid). If you're used to seeing AdSense ads on Web pages, ad units are what you've probably seen most of in the past.

    A link unit is a slim box of links with no descriptive text. The title of the box is "Ads by Google" and the links are one- or two-word entries, like "Digital Cameras" or "Consumer Electronics." If a visitor clicks on one of these links, Google serves up a new page that's filled with ads for that topic. If the visitor then clicks one of these ads, you get paid.

    Note: Google is constantly tweaking and refining the types of ads it offers. Don't be surprised if you find even more types of ad formats available when you check out the AdSense program.
  3. Choose the exact type of ad (from the list box next to ad unit or link unit) .

    If you're creating a link unit, you're limited to choosing how many links appear in the box.

    If you're creating an ad unit, you can choose whether you want to use text or image ads. Generally, image ads stand out more than text ads. However, you need to balance two conflicting goalsthe desire to make money by attracting clicks with eye-catching ads, and the desire to minimize the distraction on your Web page by choosing ad types that are less obtrusive.

    Figure 13-5 shows one possible ad type and page layout selection.

    Figure 13-5. This example uses text-only ad units. The ad layout is a 300 x 250 pixel rectangle, which holds four ads, one on top of the other. Of course, the only way you'll know how many ads fit into this layout is by checking out Google's sample-ad page (see Figure 13-6).

  4. Choose the ad layout .

    The ad layout determines the size of an ad. If you've chosen a text-only ad, Google uses a box with several ads inside it. The ad layout option also determines how many ads you'll see at once (from one to five). It's usually impossible to picture what the different ad layouts really look like. To orient yourself, click the View Samples link, which opens a new window with an example of every ad layout option (see Figure 13-6). Using this page, you can find the format that best suits your Web site.

    Figure 13-6. Google has an ad option for virtually any Web site layout. Click the "View sample placements" link (circled) next to any type of ad to see how you can integrate the ad into a sample Web page.
    Top: Vertical and horizontal groups of text ads are the most common types of AdSense layouts that you'll see out on the Web.
    Middle: Image ads are eye-catching, but they can take the focus away from a more modest Web site.
    Bottom: Link units fit almost anywhere . They provide brief topic links that lead to more detailed pages with lists of Google ads.

  5. Choose a color palette. (This step is optional.)

    The color palette sets the colors that are used for the ad text, background, and border. Google has preset palettes, with names that rival designer paint lines ("Mother Earth" and "Fresh Mint" are two examples). As you choose the palette you want to use, Google demonstrates the result with a small preview ad on the right.

    If you want complete control over your colors and want to make sure they match the ones you're using in your Web site, you need to create a custom color palette. Click the "Manage color palettes" link (see Figure 13-7).

    Figure 13-7. To create a custom color palette, begin by choosing one of the existing color palettes as a starting point. Next, modify the colors of different parts of the ad, one by one. For example, to modify the color used for the ad text, click the Text radio button, and type in the HTML color code (Section Finally, give your custom palette a name and click Save to store it for future use. Once your palette's saved, you can choose it from the list of palettes the next time you create an ad.

    Note: Usually, you'll choose ad backgrounds and text colors that match the colors you're already using in your Web pages. For some advice about how to choose HTML colors, see Section 6.2.2.
  6. Choose an alternate ad. (This step is optional.)

    When you first place the ad unit on a page, Google doesn't yet know what ads are a good match for your content. Instead it uses some generic ads, like news headlines or messages from nonprofit organizations. Google's text-sniffing software pays a visit to your page shortly after, and the real ads materialize within a couple of days.

    If you don't want to put up with the generic ads for any period of time, you can choose alternate content. You have two optionsyou can choose an alternate color, in which case Google will insert a block of color and not give you any ad content. The idea is that you'll use a color that matches the background of your page, so it disappears entirely. Your second option is to specify a URL for a page you want to use. Until the real ads are ready, that's the content that appears in your page.

    Note: Alternate ads probably aren't worth the trouble. It's better to use the generic ads, because the ad layout is the same, which makes it easy to place the ad in the right place and get an idea of what it looks like alongside the rest of your site's content.
  7. Choose a channel. (This step is optional.)

    Ordinarily, if you generate a half- dozen ads, and scatter them on different pages throughout your site, you don't know which ones are making you money. Google's report only shows you the total clicks for all pages on your site. Some site owners need more detailed information about which ads are working. Enter Google's channels feature.

    If you want to track the performance of different ads or different pages, you need to create distinct channels. The idea is that you place each ad in a separate, virtual "channel." Google then lets you create reports that compare each channel, so you can tell which one is performing best.

    If you've created a channel, you can select it from the list. To create a new channel, click the "Manage channels" link, which takes you to the page shown in Figure 13-8.

    Tip: Channels are a great way to try out different ad strategies, and see which ad formats and ad placements have the most success garnering clicks from your visitors.
  8. If the page where you're going to place the ad uses frames , turn on the "Ad will be placed on a framed page" checkbox .

    If your Web page uses frames, Google needs to know about it, so it can scan the content of the correct frame. When using frames, you need to put your ad in the content part, not in other frames (like titles or navigation bars). If you put an ad in a page without any content, Google won't be able to figure out what kind of ads are relevant to your Web site. For more on frames, see Chapter 10.

  9. The text box at the bottom of the page now has your complete, customized ad unit code (see Figure 13-9) .

    Click in the text box to select it, and then copy its contents by pressing Ctrl+C ( -C). You're now ready to paste it, by clicking Ctrl+V ( -V) into one or more Web pages, as described in the next section.

Figure 13-8. Creating a custom in a name, click "Create channel, and then click Activate. You can add multiple ads to the same channel to track them as a group, or you can create a separate channel for each ad you use.

13.2.3. Placing Ads in Your Web Pages

Once you've generated the ad script, you're ready to pop it into any Web page. Horizontal strips are easiest to position. You simply need to paste the entire script right where you want it to appear.

Here's an example that places the ads at the bottom of a page:

 <html> <head></head> <body> <h1>A Trip to Remember</h1> <p><img border="0" src="me.jpg" class="floatLeft"> After returning from my three-month travel adventure</p> <p>I hope you enjoy these pictures as much as I do.</p>  <p>See pictures from</p> <script type="text/javascript"><!-- google_ad_client = "pub-5867479552359052"; google_ad_width = 728; google_ad_height = 90; google_ad_format = "728x90_as"; google_ad_type = "text"; google_ad_channel =""; google_color_border = "006600"; google_color_bg = "FDF5E6"; google_color_link = "000000"; google_color_url = "0033FF"; google_color_text = "000000";    //--></script>     <script type="text/javascript"     src="">    </script>   </body>   </html> 

Figure 13-9. The ad unit doesn't consist of HTML elementsinstead, it's a JavaScript (which you'll Google uses a script because it needs to be able to generate blocks of ads dynamically, according to the preferences you've chosen. Whenever your page gets requested , the Google ad script runs, communicates with the Google Web servers, and asks for a set of ads. The Google Web server looks up some relevant ads, applies your layout and color options, and then sends the final block of HTML back to the script so it can be inserted into your page.

Figure 13-10 shows the result.

Positioning vertical ad strips requires a little more work, but it's easy once you learn the trick. The challenge is that you want the rest of your page content to flow beside the vertical ad. As you learned in Chapter 9, there are two techniques that can help you accomplish this feat. You can use invisible tables and lock the ad unit into a specific cell , or you can use style sheet rules to float the ads on the side of the page. .

Figure 13-10. A 728 x 90 pixel horizontal slab provides four ads for this page. The Google bot hasn't visited this site yet, so the initial set of ads consists of generic news headlines. But notice how the background ad color matches the background heading color, thanks to the creation of a custom palette (Section 13.2.2).

To use the style sheet approach, begin by wrapping your script in a <div> tag. Here's an example featuring the same content you saw in Figure 13-10; the <div> tag lines are highlighted:

 <html> <head></head> <body>  <div class="floatRight">  <h1>A Trip to Remember</h1> <script type="text/javascript"><!-- google_ad_client = "pub-5867479552359052"; google_ad_width = 120; google_ad_height = 240; google_ad_format = "728x90_as"; google_ad_type = "text"; google_ad_channel =""; google_color_border = "006600"; google_color_bg = "FDF5E6"; google_color_link = "000000"; google_color_url = "0033FF"; google_color_text = "000000";    //--></script>     <script type="text/javascript"      src="http://page">  </script>  </div>  <p><img border="0" src="me.jpg" class="floatLeft">   After returning from my three-month travel adventure</p> <p>I hope you enjoy these pictures as much as I do.</p> <p>See pictures from</p> </body> </html> 

Notice that the <div> tag (which has no formatting of its own), uses the style sheet class floatRight . In your style sheet, you use this rule to make the <div> section float with the float attribute (see Section 7.2.3). Here's what you need:

 .floatRight {   float: right;   margin-left: 20px; } 

Figure 13-11 shows the result.

13.2.4. Google-Powered Searches

Google has one more way for you to please your visitors (and earn some cash in the process). You can add a Google search box to a Web page, letting visitors launch their Google queries right from your site. Even better, you get the earnings for any ads they click in the search resultsa feature Google calls (rather unimaginatively) "AdSense for search."

Once you have an AdSense account, it's easy to get the Google search box so you can add it to your site:

  1. Log in to your AdSense account, and click the "AdSense for Search" tab .

    The "AdSense for Search" page is a lot like the "AdSense for Content" page. It asks you a series of questions, and gives you a block of HTML you can copy into your Web page at the end.

  2. Select the language and country of your Web site .

    The standard options are English and United States. As you probably know, Google has country-specific pages that can tweak search results, providing them in different languages or giving priority to local sites.

  3. Choose Google Search (if you want visitors to be able to explore the whole Web, including your site) or Google SiteSearch (if you want them to be confined to just searching the pages on your site) .

    Figure 13-11. A 120 x 240 vertical banner fits two ads into this page. Vertical ads are the most popular way to integrate Google ads into a page. Not only do they tuck neatly next to the Web page's content, but if you make them long enough, they remain visible as the Web surfer scrolls down the page.

    Google Search is the original Google search engine we all know and love.

    Google SiteSearch is an innovative ideait's a search box just for searching your site . For example, if you have dozens of pages of travel stories, a visitor could home in on the page they want by typing " funny story about rubber chicken in Peru" into a SiteSearch box. However, there's one catch. SiteSearch still uses Google's standard, centralized catalog of Web pages; it just limits the search to the pages from your site. But if Google doesn't have the page in its catalog (either because you just created it or because Google doesn't know your site exists), SiteSearch won't find it.

    If you want to provide both options (Google Search and Google Site Search), just follow these instructions twice to create two different text boxes. But be careful you don't wind up confusing your visitors.

    Tip: If you decide to use SiteSearch, use the search engine tips in Chapter 11 to make sure Google knows you're alive .
  4. If you want to filter out profanity and sexual content from search results, choose the SafeSearch option .

    SafeSearch is useful in two situations. First, it's de rigueur for sites that provide children's content. Second, it's handy if your Web site deals in a topic that shares some keywords with adult-only sites. For example, if you're creating a breast cancer awareness page, you don't want searches for " breast exam" to dig up the wrong goods.

    How AdSense Creates Targeted Ads

    Every time you serve up a Web page that contains Google ads, the AdSense script sends a message to the Google Web server asking for ads. This message includes your ad preference information and your unique client ID. (Your client ID is something like pub-5867479552359052 ; you can see it in the script code.)

    The first time Google receives this request, it realizes that it hasn't examined your page yet, and it doesn't know what types of ads are best suited for it. Instead, Google sends you a block of generic ads (or sends back your alternate content, if you choose that feature as described on Section 13.2.2). Google also adds your page to a list of pages it needs to visit. Sometime in the next couple of days, the AdSense robot heads over to your site and analyzes its content. From that point forward, you'll see ads that are based on the content of your page.

    If 48 hours pass and you still aren't getting targeted ads, there could be a problem. One of the most common mistakes is putting ads on pages that don't have much text, in which case Google can't figure out what your site is really all about. (Remember, Google only considers a single pagethe one with the ad unitnot any other pages in your site.) Another potential problem occurs if you put your ad in an inaccessible page. For example, the Google bot can't get to any page that's not on the Internetpages on your personal computer or a local network just can't cut it. Likewise with pages that are password-protected. Some Web sites block off robots using exclusion rules (Section in Chapter 11). These also stop the AdSense bot cold.

  5. Tailor the appearance of the Google search box .

    You can tweak the background color, width, and placement of the logo and search button (see Figure 13-12).

  6. Choose any optional features you want .

    Select " Open search results in a new browser window" if you want a new page to pop up with the results of the visitor's search. Pop-up windows are usually annoying to Web surfers, but are handy if you want to make sure your Web site sticks around on the visitor's desktop.

    Choose a style palette for the search results page. This way, the search results can blend in with the color scheme used in the rest of your Web site. Style palettes are almost the same as the color palettes discussed with ad creation (Section 13.2.2), except they also let you add a custom logo.

    Choose a channel if you want to track the ad dollars you make from this search box. See Section 13.2.2 for more information about channels.

    Figure 13-12. There's not a lot to change here, but Google gives you a little flexibility to alter how the search box appears.

  7. The text box at the bottom of the page now has your complete, customized search engine box (see Figure 13-13) .

    You can copy this HTML with a quick Ctrl+C ( -C) and paste it, via Ctrl+V ( -V) into any Web page.

Note: For even more details and tips about the Google AdSense program, check out Google: The Missing Manual .

Creating Web Sites. The Missing Manual
Creating Web Sites: The Missing Manual
ISBN: B0057DA53M
Year: 2003
Pages: 135 © 2008-2017.
If you may any questions please contact us: