Mobile Sites Reference

Important: Read the Terms and Conditions before using this code

To use this code you must have an AdSense account with active permission to use AdSense Custom Search Ads for Mobile. Custom Search Ads will automatically detect when to apply mobile formatting for browsers.

Parameters

Page Level Parameter Descriptions

These parameters only need to be specified once per page, and affect all units on the page.

Required

Parameter Description and Examples
adPage Optional

The adPage parameter specifies the results page ads are being displayed on. This parameter is used when users navigate past the first page of search results. For example, if five ads are requested, and the adPage parameter is set to 2, the returned ads will be the second page of five ads.

pubId Required
This is your AdSense publisher ID and must be in the format pub-xxxxxxxxxxxxxxxx.

Example:

'pubId' : 'pub-xxxxxxxxxxxxxxxx'

query Required
This is the search query entered by the user.

Examples:

'query' : 'flowers'
'query' : myQuery // where myQuery is a JavaScript variable containing the search query

Configuration Settings

Parameter Description and Examples
adtest Optional
The adtest parameter is used to indicate that a request for ads is a test. When the adtest parameter has a value of on, Google treats the request as a test and does not count the ad impressions or track the clickthrough results.

When the adtest parameter has a value of on, you do not generate any revenue.

Use this parameter when testing, but do not use it in production systems or you will not be paid for ads that you display.

The default adtest value is off.

channel Optional
You may include an AdSense for Search channel for tracking the performance of different pages. Use the unique channel ID generated from your AdSense account. Learn more about channels. Multiple channels should be separated by the '+' symbol.

Examples:

'channel' : '123456789'
'channel' : '123456789+987654321'

hl Optional
This parameter identifies the language that the requested ads should target. The default value is en.

Google supports the following values for the hl parameter:

Language hl
Arabic ar
Bulgarian bg
Chinese (China) zh_CN
Chinese (Taiwan) zh_TW
Croatian hr
Czech cs
Danish da
Dutch nl
English en
Finnish fi
French fr
German de
Greek el
Hebrew iw
Hungarian hu
Italian it
Japanese ja
Korean ko
Norwegian no
Polish pl
Portuguese pt
Romanian ro
Russian ru
Serbian sr
Slovak sk
Spanish es
Swedish sv
Thai th
Turkish tr

Note: Advertisers specify the languages that their ads target. If you include this parameter in your request, Google only returns ads that are targeted for that language or targeted for all languages but it does not guarantee that the ad text will be in the specified language.

Typically, you should set the hl parameter to the primary language of the page from which this parameter is sent.

Examples:

'hl' : 'es'

ie Optional

The ie parameter sets the character encoding scheme that should be used to interpret the query string.

The default ie value is latin1. Please look at the oe parameter for the full list of possible values.

oe Optional

The oe parameter sets the character encoding scheme that Google should use to encode the text of the ads. While technically optional, it's good practice to pass a value for this parameter.

The default oe value is latin1.

Value Standard name Associated Supported Languages
latin1 ISO-8859-1 Western European (Catalan, Danish, Dutch, English, Finnish, French, German, Indonesian, Italian, Norwegian, Portuguese, Spanish, Swedish)
latin2 ISO-8859-2 Eastern European (Croatian, Czech, Hungarian, Polish, Romanian, Serbian, Slovak, Slovenian)
latin3 ISO-8859-3  
latin4 ISO-8859-4 Baltic (Estonian, Latvian, Lithuanian)
cyrillic ISO-8859-5 Bulgarian, Russian
arabic ISO-8859-6  
greek ISO-8859-7 Greek
hebrew ISO-8859-8 Hebrew
latin5 ISO-8859-9  
latin6 ISO-8859-10 Icelandic
euc-jp EUC-JP Japanese
euc-kr EUC-KR Korean
sjis Shift_JIS Japanese
big5 Big5 Traditional Chinese
gb GB2312 Simplified Chinese
utf8 UTF-8 All

Ad Extensions

Parameter Description and Examples
clickToCall Optional
Call extensions are ad extensions that allow advertisers to include their phone number in their ads. These extensions add a clickable phone number to the ad, making it easy for customers to call advertisers directly.
When a user clicks the phone number, the browser launches the system dialer and initiates a call. By default, Call extensions are enabled. If you wish to disable them use this line of code:

'clickToCall' : false

sellerRatings Optional

Seller rating extensions provide user-submitted ratings information about sellers next to their ads. These reviews reflect users' buying experience with these businesses, rather than their experience with particular products.

This feature is offered as a service to our users to let them know about advertisers who are rated well by their customers while viewing relevant ads. This helps users make more informed web browsing and purchase decisions while helping advertisers increase their potential for earning more qualified leads.

By default, seller ratings are enabled. If you wish to disable them use this line of code:

'sellerRatings' : false
siteLinks Optional

Ad Sitelinks is a feature that lets advertisers include up to 2 additional links to deeper content on their site beyond the main landing page. Sitelinks extend the value of ads by showcasing additional targeted and relevant links for users whose search queries have triggered these ads.

By default, Ad Sitelinks are enabled. If you wish to disable them use this line of code:

'siteLinks' : false

Unit Level Parameter Descriptions

These parameters affect the way individual ad units on a page are presented to the user each parameter can be set individually for each ad unit.

Required

Parameter Description and Examples
container Required
The id of the empty ad container <div id='adcontainer1'></div> where the ad should appear.

Example:

'container' : 'adcontainer1'

maxTop Required when the ad unit is above the search results.

Use this parameter to specify the number of ads to be shown on the top ad unit.

Note: This parameter is used in place of the 'number' parameter. This ad unit should be wide enough so the first line of the ads doesn't wrap. Using the maxTop parameter on any other placement on the page is a policy violation.

Example:

'maxTop' : 4
width Optional
Specifies how wide an ad unit will be. It can be specified in pixel values or can be sized automatically to the width of the ad container by choosing 'auto'. The default value is 'auto'.

Example:

'width' : '500px'

Configuration Settings

Parameter Description and Examples
lines Optional
This specifies the number of lines each ad should attempt to display on. For ads at the top or bottom of search results we recommend three lines. Ad text will automatically wrap if there isn't sufficient space to display on the lines selected.

The only supported values are 1, 2 and 3. The default value is 3.

Examples:

'lines' : 1
'lines' : 2
'lines' : 3

Test the difference between 1-line, 2-line and 3-line ads using the code generator.

number Optional
The number of ads which should appear in this unit. The default value is 2.

Example:

'number' : 4

Font

Parameter Description and Examples
fontFamily Optional
Specifies the font family of the entire ad unit. The default font is Arial.
Supported font families are:
  • 'verdana'
  • 'arial'
  • 'tahoma'
  • 'times new roman'
  • 'georgia'
  • 'trebuchet ms'

Examples:

'fontFamily' : 'georgia'

fontSizeDescription Optional
Specifies the size (in pixels) of the ad description text. Valid values are from 8-16px. Default size is 12px

Example:

'fontSizeDescription' : 10

fontSizeDomainLink Optional
Specifies the size (in pixels) of the link to the advertiser's site. Valid values are from 8-16px. Default size is 12px

Example:

'fontSizeDomainLink' : 14

fontSizeTitle Optional
Specifies the size (in pixels) of the ad title. Valid values are from 8-16px. Default size is 12px.

Example:

'fontSizeTitle' : 12

Color

Parameter Description and Examples
colorBackground Optional
Specifies the background color of the ad.

Example:

'colorBackground' : '#FFFFFF'

colorBorder Optional
Specifies a 1px border color for the ad unit. If none is provided the ad unit will have no border.

Example:

'colorBorder' : '#0099FF'

colorDomainLink Optional
Specifies the color of the link to the advertiser's site.

Example:

'colorDomainLink' : '#000000'

colorText Optional
Specifies the color of the ad description text.

Example:

'colorText' : '#000000'

colorTitleLink Optional
Specifies the color of the ad title.

Example:

'colorTitleLink' : '#000000'

Release Notes

September 30, 2013
  • Remove parameter: adstyle
August 27, 2012