Reference - Single Format

Important: Review the individual terms of your contract before using this code on your site.

Using the Single Format

To choose the single format when calling AFSh ads, use single-product as the first parameter in your _googCsa call.

Example:

_googCsa('single-product', pageOptions, afshblock);

There are two different ways to trigger AFSh ads in the Single format:

  • gtin (Recommended)
  • query

Using gtin is recommended to ensure the highest coverage and to ensure that you return exactly the product that you are trying to show on the page.

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'

gtin Optional (Recommended)

The GTIN (Global Trade Item Number) of the product which the user wants to be returned.

Note: An invalid GTIN will result in no ads being returned. You can visit google.com/shopping to check the GTIN for validity.

Example:

'gtin': '00886227253685'

query Optional

The product title of the product to show.

Examples:

'query' : 'Nexus 7 Tablet'

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:
  • '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.

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 pages

Example:

'hl' : 'es'

testgl Optional
This parameter overrides the ad geotargeting and explicity 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 'adtest' = 'on'.

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 white or light gray will not work, since they are not readable on a white background.

Example:

'textColorPalette' : ['#910e1c']
'textColorPalette' : ['purple']
'textColorPalette' : ['#910e1c', 'purple']

priceCurrency Optional
For price filtering. The three-letter ISO Currency Code specifying the currency unit of priceMin and/or priceMax.

Required with priceMin and/or priceMax parameters.

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 priceMin or priceMax must be provided and valid. Both will be enforced if provided. priceCurrency must also be specified.

If an invalid priceMin or priceMax value is provided, that parameter will be ignored and only one parameter will be enforced.

If priceMin is greater than priceMax, both parameters will be ignored and no price filtering will be applied.

The parameter is valid if:

  • Contains only numeric characters and periods (e.g. 19.95).
  • Contains no currency symbols ($) or commas(,).

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 priceMin or priceMax must be provided and valid. Both will be enforced if provided. priceCurrency must also be specified.

If an invalid priceMin or priceMax is provided, that parameter will be ignored and only one parameter will be enforced.

If priceMin is greater than priceMax, both parameters will be ignored and no price filtering will be applied.

The parameter is valid if:

  • Contains only numeric characters and periods (e.g. 19.95).
  • Contains no currency symbols ($) or commas(,).

Example:

'priceMax' : 100
'priceMax' : 99.95

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 <div id='afshcontainer'></div> where the AFSh ad should appear.

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