Search
Clear search
Close search
Google apps
Main menu
true

AdSense for Search (AFS)

Implement a custom search engine

To add a custom search engine to your site, you first generate the search box code in your AdSense account and then copy and paste that code into the HTML of your pages. You can either add the default search code to start providing search to your users right away, or spend some time customizing your search engine before pasting the code.

Before you start

If you haven't already, add the AdSense for search product to your AdSense account:

  1. Sign in to your AdSense account.
  2. In the left navigation panel, click My ads.
  3. Click Other products.
  4. Under "Search", click Get started with AdSense for search.

    When you see the "Search" option on your My ads page, you're ready to create your first custom search engine.

Create a custom search engine

To create a new custom search engine for your site, follow these steps:

  1. Sign in to your AdSense account.
  2. In the left navigation panel, click My ads.
  3. Click Search.
  4. Click +New custom search engine.
  5. Give your search engine a name.
  6. (Optional) Customize your custom search engine:

    View customization options

    1. Choose whether you want your search engine to search the entire web, or specific sites you list.
    2. Choose which keywords you'd like Google to use to make sure that we promote the most relevant ads and pages in your search engine's search results. Learn more about keywords for AdSense for search.
    3. Leave the checkbox selected if you want to use Google SafeSearch. Google's SafeSearch screens for sites that contain pornography and explicit sexual content and eliminates them from search results. While no filter is 100% accurate, Google's filter uses advanced proprietary technology that checks keywords and phrases, URLs and Open Directory categories.
    4. Choose which country version of Google will be searched through for your search box. For example, your search results could come from google.com, google.ie, google.fr, etc.
    5. Select the primary language of your site.
    6. Choose which encoding you want to use for your search engine. We suggest you choose the search encoding that matches the encoding of your browser.
    7. Select your transliteration languages. Enabling transliteration for your search engine allows your site visitors to type a query phonetically in English and have that query appear in another language. Learn more about transliteration
    8. Choose whether you want to use popular queries. Popular queries is a feature that lets your users see what others have been searching for on your site. Popular queries are updated daily and dynamically show the most recent data.
    9. In the "Custom channels" section, set up a custom channel if you'd like to track the performance of your search engine. Learn more about custom channels.
    10. In the "Search box style" section, choose a style for the search box of your search engine.
    11. In the "Search results" section, choose how you'd like to display search results within a page on your site, e.g., on a Google page in the same window, on a Google page in a new window, etc.
  7. Click Save and get code.
  8. Copy the code from the "Search Box Code" window and paste it into the HTML of your pages where you want your search engine to appear.

    AFS code

If you'd like more details about adding ad code to your pages, see the Code Implementation Guide.

Was this article helpful?
How can we improve it?
Sign in to AdSense

Sign in to AdSense to see help for your account Don't have an AdSense account? Sign Up for AdSense!