Gets the AdSense code for a given ad client. This returns what was previously known as the 'auto ad code'.
This is only supported for ad clients with a productCode of AFC.
For more information, see About the AdSense code.
HTTP request
GET https://adsense.googleapis.com/v2/{name=accounts/*/adclients/*}/adcode
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
name |
Required. Name of the ad client for which to get the adcode. Format: accounts/{account}/adclients/{adclient} |
Request body
The request body must be empty.
Response body
Representation of the AdSense code for a given ad client.
For more information, see About the AdSense code.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "adCode": string, "ampHead": string, "ampBody": string } |
Fields | |
---|---|
adCode |
Output only. The AdSense code snippet to add to the head of an HTML page. |
ampHead |
Output only. The AdSense code snippet to add to the head of an AMP page. |
ampBody |
Output only. The AdSense code snippet to add to the body of an AMP page. |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/adsense
https://www.googleapis.com/auth/adsense.readonly