Important: Review the individual terms of your contract before using this code on your site.
Using the Multiple Format
To choose the multiple format when calling AFSh ads, use plas as the first parameter in your _googCsa call.
Example:
_googCsa('plas', pageOptions, afshblock);
Parameters
Note: For parameters marked *, contact your Technical Account Manager to enable these features on your client ids.
Page Level Parameter Descriptions
These parameters only need to be specified once per page, and affects the AFSh unit on the page.
Parameter | Description and Examples |
---|---|
pubId
|
Required This is your AdSense client-ID. Your AFSh pubId is the part of your client-ID that comes after 'partner-'. For example, if your client-ID is 'partner-vert-pla-test-srp', your pubId is 'vert-pla-test-srp'. Example: 'pubId' : 'test client-ID' |
query
|
Required This is the search query entered by the user. The value of the query parameter should be unencoded. Examples: 'query' : 'flowers' 'query' : 'black & decker' 'query' : myQuery // where myQuery is a JavaScript variable containing the search query |
adsafe
|
Optional Specifies the filtering rules that Google should apply to ads matching the search query. The following are the valid settings for adsafe and the effect each value has on returned ads:
By default adsafe is set to high. Example:'adsafe': 'medium' |
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. Example:'adtest' : 'on' |
channel
|
Optional You may include an AdSense for Shopping channel for tracking the performance of different pages. Use the unique channel ID generated from your AdSense account. Multiple channels should be separated by the '+' symbol. Channel names have a maximum length of 30 characters. Example: 'channel ' : 'testA' 'channel ' : 'testA+testB' |
hl
|
Optional This parameter identifies the language that the requested ads should target. The default value is en. Google supports all AdWords API language codes. 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. This parameter is required for non-English pagesExample: 'hl' : 'es' |
testgl
|
Optional This parameter overrides the ad geotargeting and explicitly sets the country used for ad targeting. The rendering of the ads will remain styled to the US default UI, but ads will be targeted to the country specified by this parameter.
Note: Ads that are returned when using this parameter may not match exactly with ads seen by the user. This parameter is meant for testing purposes and can only be used with the parameter Example: 'testgl' : 'de' |
textColorPalette
|
Optional This parameter specifies a palette of colors to use for text elements in the ad (e.g. Merchant Name). The palette of colors is provided as an array of CSS color values. Currently, only the first color in the array is used.
Valid colors must adhere to the WCAG 2.0 normal text standard for text contrast against a background. If the color is not valid, the default color will be displayed. For example, colors like #ffffff or #d3d3d3 gray will not work, since they are not readable on a white background. Example: 'textColorPalette' : ['#910e1c'] 'textColorPalette' : ['#800080'] 'textColorPalette' : ['#910e1c', '#800080'] |
priceCurrency
|
Optional For price filtering. The three-letter ISO Currency Code specifying the currency unit of priceMin and/or priceMax .
Required with The price filter is not applied if the currency code does not match the currency of the returned ads. The parameter is case-insensitive. Example: 'priceCurrency' : 'USD' |
priceMin
|
Optional For price filtering. Specifies the minimum product price for ads that should be returned by the ad request (in units of currency). At least one of If an invalid If The parameter is valid if:
Example: 'priceMin' : 25 'priceMin' : 19.95 |
priceMax
|
Optional For price filtering. Specifies the maximum product price for ads that should be returned by the ad request (in units of currency). At least one of If an invalid If The parameter is valid if:
Example: 'priceMax' : 100 'priceMax' : 99.95 |
styleId
|
Optional The custom search style ID of the ad, indicating which predefined style to use. Learn more about using custom search styles. Note that with the styleId set for a request, ads will be rendered with the style, and other styling parameters for ad elements such as textColorPalette will be ignored. Note: make sure that Example: 'styleId': '1234567891' |
Unit Level Parameter Descriptions
These parameters affect the display of individual ad unit on a page. Note that AdSense for Shopping only supports 1 adblock per call.
Parameter | Description and Examples |
---|---|
container
|
Required The id of the empty ad container Example: 'container' : 'afshcontainer' |
width
|
Required Specifies the width of the ad unit in pixels. Note: auto or % values will not work. Example: 'width' : 500 |
height
|
Required Specifies the height of the ad unit in pixels. Note: auto or % values will not work. Example: 'height' : 400 |
number
|
Optional The number of ads which should appear in this unit. Only used together with styleId . The default value is 1.
Example: 'number' : 2 |
enableInteractive
|
Optional Set to true to enable interactive layout on mobile devices. The default value is false. Example: 'enableInteractive' : true |
Release Notes
November 25, 2019- Added parameter: styleId, number and enableInteractive
- Deprecated parameter: promoted