AdSense Custom Search Ads for Websites - Implementation Guide

AdSense Custom Search Ads are the crown jewel of online ads. This is a comprehensive guide to help you fully understand how to setup AdSense CSA on your Website.

This guide focuses on how to set up Custom Search Ads on Desktop & Mobile sites.

Updated September 24th, 2019

Setting up your AdSense Custom Search Ads is essential in maximizing revenues for your search engine, while staying Policy compliant at all times.

The first thing you will need to do is confirm that your AdSense account has active permissions to use AdSense Custom Search Ads on your website. Custom Search Ads (sometimes also called AdSense for Search Ads – AFS) can be a little confusing because publishers might assume that their AdSense account automatically has access to search ads or that Responsive Text Ads are the same as Search Ads.

To check if you have active permissions for Custom Search Ads navigate to Account > Settings > Account Information. Here you should see ‘Search’ under Active Products. If you do not see ‘Search’ under your AdSense Active Permissions, then you would first need to apply for Custom Search ads. Check out our article on How to get AdSense Custom Search Ads for your Website to get started.

For everyone who already has active search ads approval, the easiest way to move forward is by using the official CSA Code Generator

The first thing you can do with the Code Generator is to configure your basic page options.

AdSense Custom Search Ads basic options

Required Options that must be used

  • Pub ID: Input your AdSense Publisher ID
  • Query: Add a query* This should be a dynamic query from your users. The query should match exactly what the user inputs and should not be modified. There are ways to offer query context to AdSense to that the query will return ads that match your site topic, such jobs, cars, shopping, etc. However, using such additional parameters generally require additional approvals from the AdSense Custom Search Ads team.
  • Number of Ad Units: Input the number of Search Ad units. The policies are extremely strict on how many ad units you can have. To be perfectly compliant and to not have to worry about any AdSense Policy issues, the safest implementation is 2 ad units and not 3 ad units. One top Ad Unit and 1 bottom Ad Unit.
  • Page Number: Since AdSense CSA shows up on your website’s search result pages, AdSense needs to know on what page in your sequence of search results the user is. For example, when a user is browsing on an e-commerce website, is the user on the 1st page of the search result or did the user already click ‘Next’ to go to the second page? This is important since it affects what ads are shown.

Configuration Settings

  • Ad Language:
    'high' Returns family-safe ads. Does not return non-family-safe or adult sexual content ads.
    'medium' Returns family-safe and non-family-safe ads. Does not return adult sexual content ads.
    'low' Returns all types of ads.
    The default setting is set to ‘high’. Based on what kind of website you are running, it would be perfectly fine to switch to ‘medium’ or ‘low’ so that that the advertiser auction competition is at its highest.
  • Channel ID: It is always a good idea to track the performance of your ads using channels. You can track based on type of device, ad location, user country, etc. Some publishers track as many as 5-10 different channel types for each ad.
  • Testing Mode: The default ad test value is set to off. It is important to set this to ON while still in a testing phase.

Ad Extensions

  • Location extension / Seller Ratings / Site Links: Depending on what kind of website you have, you might want to opt leaving all extensions on or off. E-commerce sites often are better off leaving all extensions ON. Job and career search engines perform better with all extensions turned OFF.

Next you decide on specific configurations for each ad unit. Custom Search Ad units are different from normal ads since CSAs can have several units, with each unit having its own customization settings.

AdSense Custom Search Ads Ad Unit options

Ad Unit Options

  • Required: The Container ID and Width in px has to be given.
  • Configuration Settings: It is very important to make it clear if the ad unit is ATF – Above The Fold or BTF – Below The Fold. Only the 1st ad unit can be set to ATF. For mobile devices the ATF should never show more than 2 ads so as not to violate CSA policy. For mobile devices the number of ads should never overtake the entire screen real-estate. This is one reason why often it is better to turn off ad extensions since they can take up a lot of space. Fewer ad extensions means the possibility for showing more ads without breaking policy. The number of ads per ad-unit should be within 1-3 if shown above or below search results. CSA shown on desktop devices in right sidebar can have more ad within a single ad-unit.
  • Fonts & Colors: CSAs are extremely flexible in that every aspect of how they look and feel can be controlled to best match your own search result. The look and feel can either be set using the Code Generator or directly from within your AdSense account under ‘Ads for search’ > ‘Custom search styles’.
  • Detailed Attribution: This setting can be useful if you want to show the user’s search query as part of the ‘Ads by Google’ text. Generally it is best to leave this off when the goal is to integrate the ads with your search results look and feel.
Custom Search ads detailed attribute for 'Ads by Google' text

Sample Custom Search Ad Code

This is the code that should go into the <head> tag on your pages:

          <script async="async" src=""></script>

<!-- other head elements from your page -->

<script type="text/javascript" charset="utf-8">
  arguments)},g[o]['t']=1*new Date})(window,'_googCsa');

This is a sample of the Ad Unit code. Place the div with the containers wherever you want the ad units to show up.

          <div id='afscontainer1'></div>
<div id='afscontainer2'></div>

<script type="text/javascript" charset="utf-8">

  var pageOptions = {
    "pubId": "pub-9616389000213823", // Make sure this the correct client ID!
    "query": "shoes",
    "adPage": 1,
    "channel": "123456"

  var adblock1 = {
    "container": "afscontainer1",
    "width": "700",
    "maxTop": 5

  var adblock2 = {
    "container": "afscontainer2",
    "width": "700",
    "number": 2

  _googCsa('ads', pageOptions, adblock1, adblock2);



Page Level Parameters

adPageUsed to show what results page in a sequence the user is on.Required
pubIdYour AdSense account’s Publisher IDRequired
queryThe exact search query as performed by the userRequired
adsafe‘high’ or ‘medium’ or ‘low’Optional
adtest‘on’ or ‘off’Optional
channel‘1234’ or ‘12345+67890’Optional
hlIdentify your preferred language. Default is set to ‘hl’ : ‘en’ Optional
ieSet character encoding for query string. Default is set to utf-8Optional
oeSet character encoding that is used for the ads. Default is set to utf-8Optional
personalizedAdsoptions are ‘true’ or ‘false’. Sample: ‘personalizedAds’: false Optional
colorLocation‘colorLocation’ : ‘#f9f9f9’Optional
domainLinkAboveDescription‘domainLinkAboveDescription’: falseOptional
fontSizeLocation‘fontSizeLocation’ : 16Optional
clickToCall (mobile only‘clickToCall’ : falseOptional
location‘location’ : true Optional
sellerRatings‘sellerRatings’ : true Optional
siteLinks‘siteLinks’ : true Optional

Unit Level Parameters

container ‘container’ : ‘searchadcontainer1’ Required
maxTop‘maxTop’ : 2 Required
width‘width’ : ‘900px’ Required
number‘number’ : 2Optional
fontFamily‘fontFamily’ : ‘roboto, arial, times new roman’ Optional
fontFamilyAttribution‘fontFamilyAttribution’ : ‘roboto, arial, times new roman’ Optional
fontSizeAnnotation‘fontSizeAnnotation’ : 18 Optional
fontSizeAttribution‘fontSizeAttribution’ : 18 Optional
fontSizeDescription‘fontSizeDescription’ : 16 Optional
fontSizeDomainLink‘fontSizeDomainLink’ : 16 Optional
fontSizeTitle‘fontSizeTitle’ : 14 Optional
colorAdBorder‘colorAdBorder’ : ‘# 8A93AC ‘ Optional
colorAdSeparator‘colorAdSeparator’ : ‘# 4DAF74 ‘ Optional
colorAnnotation‘colorAnnotation’ : ‘# 7143F8 ‘ Optional
colorAttribution‘colorAttribution’ : ‘# 408b5e ‘ Optional
colorBackground‘colorBackground’ : ‘# FBFBFD ‘ Optional
colorBorder‘colorBorder’ : ‘# FBFBFD ‘ Optional
colorDomainLink‘colorDomainLink’ : ‘# 8A93AC ‘ Optional
colorText‘colorText’ : ‘# 8A93AC ‘ Optional
colorTitleLink‘colorTitleLink’ : ‘# 8A93AC ‘ Optional
adBorderSelections‘adBorderSelections’: ‘top, left’ Optional
adjustableLineHeight‘lineHeightTitle’ : 18
‘lineHeightDescription’ : 16
‘lineHeightDomainLink’ : 16
attributionSpacingBelow‘attributionSpacingBelow’ : 4 Optional
borderSelections‘borderSelections’: ‘top, left’ Optional
noTitleUnderline‘noTitleUnderline’: false Optional
titleBold‘titleBold’ : false Optional
verticalSpacing‘verticalSpacing’ : 3 Optional
detailedAttribution‘detailedAttribution’ : true Optional

You can always find the complete list of up-to-date parameters here.

Ads for Search – Custom Search Styles

Recently the AdSense team launched a new feature that would allow publishers with access to Custom Search Ads to style their AFS ads directly from within their AdSense interface.

The new feature is called ‘Custom Search Styles’.

AdSense Search Styles Banner

Search Styles allows you to select from ready made templates that focus on different layouts. There is an ever increasing number of basic layouts ranging from ‘Headline First’, ‘Headline First with Icon’, ‘Seller First Card Style’ and more. Especially large AdSense accounts will also have the opportunity to apply for something called ‘Native AdSense Custom Search Ads’. Native Search Ads give additional flexibility in creating custom Search Ads templates that match the style of your search results even better.

Search Styles Templates for AdSense Custom Search Ads

Once you have selected a pre-built search style, you can start customizing the design as well as deciding what features of the ad unit are active or inactive. You can customize everything from the look and feel of your Display URL, Headline and Description, all the way to Global Options that control Padding, Borders and the ad unit’s Background Color.

Once you have completed all basic styling of the search ad unit, you can move on to the ‘Extensions’ tab where the styling of everything from Sitelinks to Ratings and Phone Numbers can be controlled.

Additional information on AdSense Custom Search styles can be found in Google’s Help Center here.

AdSense Custom Search Ads Policies

AdSense Custom Search Ads Policies. Policies for AdSense For Search Ads.

AdSense Custom Search Ads aka AdSense for Search Ads have come a long way since they were first introduced several years ago. CSA/AFS ads are still considered the cold standard when it comes to online ads. For that reason relatively few publishers have active permissions to use Custom Search Ads. Advertisers shown in Custom Search Ads are exclusively those that are actively targeting the Google Search Network, and are willing to bid more because they can rest assured that users seeing their ads are highly targeted and relevant. For that reason Custom Search Ads have their own AdSense Policies that are strictly enforced and go beyond the policy requirements of normal AdSense ads.

Publishers who do not adhere to CSA policies quickly risk not only losing access to Custom Search Ads but also to have their AdSense account be disabled. To help you always be compliant, let’s dive into all the supplemental policies that publishers need to stick to for Custom Search Ads.

General Policies

  1. All user queries that result in Custom Search Ads being served need to come from one of the following two sources:
    • A search query that was entered into the search box by the user. The query needs to remain unchanged, without modifications and any filtering applied to the query string.
    • Via a so called ASQ. ASQ stands for ‘Alternative Search Query’. ASQs have their own policies that will be explained below.
  2. A user action my only make one request for Custom Search Ads. A user action can be one of two things:
    • A click by the user
    • A scroll that initiates asynchronous loading for more search results on your site
  3. CSA is not permitted on copyrighted content or on content that in any way violates AdSense content guidelines.
  4. CSA Ad Units are only permitted to be used on search results pages.
  5. Search Ad Units must be clearly distinguishable from the search results on your page.
  6. User must not be incentivized in any form or manner for performing searches or viewing custom search ads.
  7. Custom Search ads should only be loaded in addition to search results being offered to a user query. If a user query triggers no search results from your search engine, CSAs should not be loaded.
  8. Custom Search Ads may not receive any other Google Ad products as backfill. Google Ad Manager, AdSense for Content or AdMob ads may not be loaded as backfill. It is also not permitted to alternate between CSA and other Google Ad products based on different type of request types on the same ad placement. This means that a publisher needs to commit to either using CSA or Ad Manager or AFC or AdMob on a specific ad placement.
  9. Custom Search Ads is not permitted to show on a page that contains ad placements with any other Google Text Ad on it.
  10. The number of Custom Search Ads shown on a page must not be more than the number of organic search results on the page.
  11. Written permission from Google is necessary for any site that wants to show Custom Search Ads on search results that are substantially made up of Images, Videos, People, Music, News Aggregation or search results that originate from a Google service such as the Youtube API.

Policies Specifically Applicable to Desktop

  1. Three Custom Search Ad units are permitted per page. One ad unit above the search results, one below the search results and a third ad unit to the side of the search results. Custom Search Ads in between search results, so called ‘Belly Ads’, require special written permission from Google. In addition, Pages with CSA are also permitted one Google Ad Manager Ad Exchange ad unit or AdSense for Content ad unit set to Display only. Also, one link unit is allowed per page.
  2. The number of search results offered by the publisher’s search engine must exceed the number of Custom Search Ads shown.
  3. A CSA Ad Unit above or below the fold may not take up more than one third of the search result space without the user scrolling.
  4. Custom Search Ad Unit to the side of the search results must not contain more than 8 ad units.

Policies Specifically Applicable to Mobiles & Tablets

  1. A maximum of 2 Custom Search ad units may be shown per search result page. Only a single request for CSAs must be made per search query.
  2. A maximum of 3 ads are permitted to show in the top ad unit and the bottom ad unit.
  3. No more than one CSA must be visible on screen at the same time.

In order to stay up-to-date on the latest policy changes best to regularly check the official Google documentation here.

Alternative Search Queries Policies (ASQ)

Alternative Search Ad Queries for AdSense Custom Search Ads
Alternative Search Ad Queries

Normally AdSense Custom Search Ads may only be triggered from a search query that is manually input into a search box by a user. The Alternative Search Queries are means of triggering Custom Search Ads that do not include a manual query that a user types into a search box. There are four different ASQs that are allowed within the guidelines of the ASQ policies:

  • Popular Searches
  • Suggested Searches
  • Related Searches
  • Category Browsing

General ASQ Policies

  • Alternative Search Queries must meet all AdSense Program Policies as well as CSA Policies, in addition to all ASQ policies.
  • Alternative Search Queries must not violate any 3rd party rights, applicable laws or Google content policies.
  • Google reserves the right to not allow certain words or phrases to be used as ASQ search queries or ad requests
  • ASQ words or phrases must match exactly the keyword(s) sent in the CSA ad request
  • Words & Phrases that make up ASQs must suggest the most relevant search queries. ASQs are not permitted to be artificially designed to generate specific ads that could artificially inflate conversions, clicks or impressions.
  • Only end-users are permitted to click on an Alternative Search Query. Each click must result in the user directly being taken to a search result page eligible for AdSense Custom Search Ads.

ASQ Policies for Popular Searches

“Popular Search” ASQ are generated from the most common searches performed by end-users on your website. When an end user clicks on a Popular Search, he is taken to a search result page on your website with Custom Search Ads.

  • Popular Search ASQ must only be generated from the most popular type-in queries performed by end-users on your website.
  • At least once per week the list of Popular Search ASQs needs to be updated to reflect changes in user search behaviour in terms of what the most popular searches on your website are.
  • Popular Search ASQs must be labeled “Popular Searches”, unless given approval by Google for a similar designation.

ASQ Policies for Suggested Searches

“Suggest Search” ASQ are suggestions shown to users within your website’s search box as the user inputs text. When the user actively selects a suggested search, the user is taken to a search result page on your site that contains AdSense Custom Search Ads.

Suggested Searches ASQ for AdSense Custom Search Ads
Suggested Searches
  • Suggested Searches must be directly relevant to the text the user is actively entering into your site’s search box.
  • Your implementation of Suggested Search ASQ needs to be materially similar to the image mockup above. Any significantly different implementation needs to receive approval from Google.

ASQ Policies for Related Searches

“Related Search” ASQs are automatically generated terms that are based on the user’s previous query. When a user click’s on a Related Search term, the user will be taken to a search result page on the same website with AdSense Custom Search Ads.

  • All Related Search ASQs must be clearly labeled “Related Searches”. Any other label must receive prior approval from Google.
  • Related searches can be placed either to the left or the the right of the search results; between the top CSA ad unit and search results; or below the search results.
  • Placing Related Searches ASQ above the top ad unit and above the search results must receive prior written approval from Google.
  • Related Search ASQs that are placed within search results must have at least 3 search results placed above the Related Search terms.
  • Related Search ASQs are not permitted to show interspersed with Google Custom Search Engine (CSE) results.
  • No more than 2 Related Search ASQs are permitted to show per page.

Related Search ASQs can be generated by you or by Google or another source. When Google is not the source that generates the Related Search ASQs, then the following policy is also in effect:

  • Related Searches must clearly show branding from the source that generated the related search terms. Google branding must not be used together with the Related Search ASQ if Google is not the source that generated the related searches.

ASQ Policies for Category Browsing

“Category Browse” ASQ refers to pages end-users encounter while browsing/navigating through your website’s directory or categories. To be eligible for CSA on Category Browse ASQs, the browsing experience must consist of significant depth and original content. As the user browses/navigates through menus or categories or directories, the user’s search query gets narrower and more detailed.

“Category Browse” ASQ is a menu or directory on your site that allows your user to narrow their search focus by navigating to a more detailed search result.

  • Category Browse ASQ will need to be sufficiently narrow in order for CSA to be permitted to show. Google will determine what level of navigational depth is required.
  • Ad requests may include the parent category when the ad request was initiated from a Category Browse ASQ.

Find the newest updates on ASQ policy in the Google Help Center here.

Pubprime AdSense Custom Search Ads monetization

AdSense Custom Search Ads – Are they the ‘best’ ads in existence?

At Pubprime we certainly think so. We are the worldwide authority when it comes to managing & monetizing Google’s AdSense Custom Search Ads on behalf of website owners. No other ad product can compare in terms of CPC monetization for websites. However, this comes with some major caveats. As the name suggests, ‘Custom Search Ads’, this ad product is not suitable for all publishers. Only websites that have their own search result pages with quality traffic and content can qualify to implement AdSense CSA. In addition, Custom Search Ads come with the strictest policy requirements of possibly any Google product.

If you are already running CSA ads on your site, and you would like help in managing your CSA and boosting revenues & RPMs even further, feel free to contact us directly. For Publishers who would like to transition from Google Custom Search Engine (CSE) to their own in-house search engine monetized with AdSense Custom Search Ads you can reach out to us by completing our site information form.

Publishers with high quality traffic in the following niches are also encouraged to reach out to us in order to boost their search page monetization with AdSense Custom Search Ads:

  • eCommerce & Shopping sites
  • Classifieds sites
  • Job Search & Career sites
  • Buy & Sell sites
  • Hotel Search / Camparison sites
  • Flight Search / Comparison sites
  • Search Engines
  • Sites that offer their own search experience