Documentation for the requested version is not available.Documentation for the requested diff is not available.
AdSenseForContentService (AFC) allows a developer to generate ad code snippets to include in a publisher's web pages to start serving and displaying contextual advertising. When an end-user clicks through an ad, Google credits a payment.
AFC also allows a user to associate Channels with the service,
create and save AdStyle objects and get
ad types with the service.
To generate an ad code snippet, you call the
generateAdCode operation, passing in eight parameters,
starting with:
Six parameters define ad layout, type, style, substitution and placement:
One parameter defines the channel:
This generateAdCode operation returns the ad code snippet as a string that you can paste into web pages to begin serving ads.
AdSenseForContentService lets you do the following and more:
Rather than modify existing ad layouts or ad unit types,
you just regenerate the code. See ChannelService
for updating channels.
Delete a named ad style from this service.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| name | string |
the name of an ad style |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 409 | if there is no style with the specified name |
Delete a collection of named ad styles from this service.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| names | string[] |
the names of some ad styles |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 201 | before deleting any styles if synServiceId is not valid |
| 409 | before deleting any styles if any of the names in names do not correspond to an existing style |
Generates the ad code snippet that can be dropped into an HTML page for the page to start receiving Google Ads.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the syndication service ID |
| adStyle | AdStyle |
the ad style |
| adUnitType | AdUnitType |
the type of ad unit or link unit.
An empty string causes the default ad unit type to be used.
(The default type is TextOnly, which can be changed at the
AdWords website.)
See Ad Formats table.
Values are:
|
| layout | AdLayout |
the layout of the ad(s). Note that the layout must be an
acceptable one based upon the ad type. Values are width x height in pixels.
See Ad Formats table.
Values are:
|
| alternate | string |
the alternate content used to replace public service
ads. This is usually nil. If this begins with a # it is
interpreted as a six-digit hexidecimal color code, typically the
background color of the page or frame on which this ad unit will
appear. Otherwise this is interpreted as a URL that should point to a
replacement ad. |
| isFramedPage | boolean |
true if the ad code snippet will be placed within a
frame in a page. |
| channelName | string |
the channel that should be used to track statistics for
this page. The channel type should be custom. If no Channel is to be
specified, this argument should be passed as nil. |
| Response type | Response description |
|---|---|
string |
html elements that can be dropped into an HTML page for the page to start receiving Google Ads. |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 314 | if synServiceId doesn't correspond to a Content Ads service |
| 401 | if adStyle's name is not valid |
| 403 | if any of adStyle's colors is not valid |
| 404 | if adUnitType is not valid |
| 405 | if adLayout is not valid |
| 406 | if the adUnitType and adLayout are incompatible |
| 410 | if alternate is not valid |
| 501 | if channelName is not valid or if channel type is not custom |
Generates the ad code snippet that can be dropped into an HTML page for the page to start receiving Google Ads.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the syndication service ID |
| adStyle | AdStyle |
the ad style |
| adUnitType | AdUnitType |
the type of ad unit or link unit.
An empty string causes the default ad unit type to be used.
(The default type is TextOnly, which can be changed at the
AdWords website.)
See Ad Formats table.
Values are:
|
| layout | AdLayout |
the layout of the ad(s). Note that the layout must be an
acceptable one based upon the ad type. Values are width x height in pixels.
See Ad Formats table.
Values are:
|
| alternate | string |
the alternate content used to replace public service
ads. This is usually nil. If this begins with a # it is
interpreted as a six-digit hexidecimal color code, typically the
background color of the page or frame on which this ad unit will
appear. Otherwise this is interpreted as a URL that should point to a
replacement ad. |
| isFramedPage | boolean |
true if the ad code snippet will be placed within a
frame in a page. |
| channelName | string |
the channel that should be used to track statistics for
this page. The channel type should be custom. If no Channel is to be
specified, this argument should be passed as nil. |
| cornerStyles | CornerStyles |
the corner style that should be used for the requested
ad unit.
Values are:
|
| hostChannelNames | string[] |
List of AFC host channels that should be used to
track statistics for this ad code. Up to five channels are allowed. If you
are not using host channels, set this field to nil. For more
information on host channels, see the
Host Channel FAQ. |
| Response type | Response description |
|---|---|
string |
an HTML snippet that can be dropped into an HTML page for the page to start receiving Google Ads. |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 314 | if synServiceId doesn't correspond to a Content Ads service |
| 401 | if adStyle's name is not valid |
| 403 | if any of adStyle's colors is not valid |
| 404 | if adUnitType is not valid |
| 405 | if adLayout is not valid |
| 406 | if the adUnitType and adLayout are incompatible |
| 410 | if alternate is not valid |
| 412 | if cornerStyles is not valid |
| 501 | if channelName or the host channel name in hostChannelNames is not valid or if channel type is not custom |
| 809 | if the number of host channel names in hostChannelNames exceeds the limitation |
Returns the active Channels associated with this syndication service for the publisher.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| type | ChannelService_Type |
the ChannelService type of the Channels
Values are:
|
| Response type | Response description |
|---|---|
ChannelService_Data[] |
an array of ChannelService_Data corresponding to the
active Channels associated with this syndication service for the publisher. |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 505 | if type is not valid |
Get all ad layouts compatible with a particular ad unit type. See Ad Formats table. Passing "" as adUnitType will get all ad layouts of the default ad unit type. (The default type is TextOnly, which can be changed at the AdWords website.)
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| adUnitType | AdUnitType |
the type of ad unit desired, or "" to return
all layouts of the default ad unit type
See Ad Formats table.
Values are:
|
| Response type | Response description |
|---|---|
AdLayout[] |
all ad layouts that can be used with adUnitType in a
call to generateAdCode. Values are width x height in pixels.
See Ad Formats table.
Values are:
|
| Error number | Error description |
|---|---|
| 404 | if adUnitType is not valid |
Returns the ad styles created by the publisher.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| Response type | Response description |
|---|---|
AdStyle[] |
an array of AdStyles created by the publisher. |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
Get all ad unit types compatible with a particular ad layout.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| adLayout | AdLayout |
the type of ad layout desired.
Values are width x height in pixels.
See Ad Formats table.
Values are:
|
| Response type | Response description |
|---|---|
AdUnitType[] |
all ad unit types that can be used with adLayout in
a call to generateAdCode.
Values are:
|
| Error number | Error description |
|---|---|
| 405 | if adLayout is not valid |
Get all ad layouts supported by Google.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| dummy | int |
a dummy argument |
| Response type | Response description |
|---|---|
AdLayout[] |
all ad layouts that can be used in a call to
generateAdCode. Values are width x height
in pixels.
See Ad Formats table.
Values are:
|
Get all ad unit types supported by Google.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| dummy | int |
a dummy argument. |
| Response type | Response description |
|---|---|
AdUnitType[] |
all ad unit types that can be used in
a call to generateAdCode.
Values are:
|
Returns the built-in ad styles created by Google.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| dummy | int |
a dummy argument |
| Response type | Response description |
|---|---|
AdStyle[] |
an array of ad styles created by Google. |
Returns the Channels associated with this syndication service for the publisher.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| type | ChannelService_Type |
the ChannelService type of the Channels
Values are:
|
| Response type | Response description |
|---|---|
ChannelService_Data[] |
an array of ChannelService_Data corresponding to the
Channels associated with this service for the publisher. |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 505 | if type is not valid |
Returns the inactive Channels associated with this syndication service for the publisher.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| type | ChannelService_Type |
the ChannelService type of the Channels
Values are:
|
| Response type | Response description |
|---|---|
ChannelService_Data[] |
an array of ChannelService_Data corresponding to the
inactive Channels associated with this syndication service for
the publisher. |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 505 | if type is not valid |
Saves a named ad style. If an ad style with this name is already saved, this will overwrite the style's contents.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| adStyle | AdStyle |
a named ad style |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 201 | if synServiceId is not valid |
| 401 | if adStyle's name is not valid |
| 402 | if adStyle's name is empty |
| 403 | if any of adStyle's color is not valid |
| 408 | if saving the ad style would go over the saved ad style limit |
Adds a collection of named ad styles to this service.
| Parameter name | Parameter type | Parameter description |
|---|---|---|
| synServiceId | string |
the ID of this service. |
| adStyles | AdStyle[] |
an array of named ad styles |
| Response type | Response description |
|---|---|
(none) |
| Error number | Error description |
|---|---|
| 201 | before saving any styles if any element of adStyles has a synServiceId that is not valid |
| 401 | before saving any styles if any element of adStyles has a name that is not valid |
| 402 | before saving any styles if any element of adStyles has a name that is empty |
| 403 | before saving any styles if any element of adStyles has a color that is not valid |
| 407 | before saving any styles if there are styles with the same name in adStyles |
| 408 | before saving any styles if saving the ad styles would go over the saved ad style limit |