class AccountsAdclientsAdunits extends Resource (View source)

The "adunits" collection of methods.

Typical usage is:

 $adsenseService = new Google\Service\Adsense(...);
 $adunits = $adsenseService->accounts_adclients_adunits;

Methods

create(string $parent, AdUnit $postBody, array $optParams = [])

Creates an ad unit. This method can be called only by a restricted set of projects, which are usually owned by AdSense for Platforms publishers.

get(string $name, array $optParams = [])

Gets an ad unit from a specified account and ad client. (adunits.get)

getAdcode(string $name, array $optParams = [])

Gets the ad unit code for a given ad unit. For more information, see About the AdSense code and Where to place the ad code in your HTML. (adunits.getAdcode)

listAccountsAdclientsAdunits(string $parent, array $optParams = [])

Lists all ad units under a specified account and ad client.

listLinkedCustomChannels(string $parent, array $optParams = [])

Lists all the custom channels available for an ad unit.

patch(string $name, AdUnit $postBody, array $optParams = [])

Updates an ad unit. This method can be called only by a restricted set of projects, which are usually owned by AdSense for Platforms publishers.

Details

AdUnit create(string $parent, AdUnit $postBody, array $optParams = [])

Creates an ad unit. This method can be called only by a restricted set of projects, which are usually owned by AdSense for Platforms publishers.

Contact your account manager if you need to use this method. Note that ad units can only be created for ad clients with an "AFC" product code. For more info see the AdClient resource. For now, this method can only be used to create DISPLAY ad units. See: https://support.google.com/adsense/answer/9183566 (adunits.create)

Parameters

string $parent

Required. Ad client to create an ad unit under. Format: accounts/{account}/adclients/{adclient}

AdUnit $postBody
array $optParams

Optional parameters.

Return Value

AdUnit

Exceptions

Exception

AdUnit get(string $name, array $optParams = [])

Gets an ad unit from a specified account and ad client. (adunits.get)

Parameters

string $name

Required. AdUnit to get information about. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}

array $optParams

Optional parameters.

Return Value

AdUnit

Exceptions

Exception

AdUnitAdCode getAdcode(string $name, array $optParams = [])

Gets the ad unit code for a given ad unit. For more information, see About the AdSense code and Where to place the ad code in your HTML. (adunits.getAdcode)

Parameters

string $name

Required. Name of the adunit for which to get the adcode. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}

array $optParams

Optional parameters.

Return Value

AdUnitAdCode

Exceptions

Exception

ListAdUnitsResponse listAccountsAdclientsAdunits(string $parent, array $optParams = [])

Lists all ad units under a specified account and ad client.

(adunits.listAccountsAdclientsAdunits)

Parameters

string $parent

Required. The ad client which owns the collection of ad units. Format: accounts/{account}/adclients/{adclient}

array $optParams

Optional parameters.

Return Value

ListAdUnitsResponse

Exceptions

Exception

ListLinkedCustomChannelsResponse listLinkedCustomChannels(string $parent, array $optParams = [])

Lists all the custom channels available for an ad unit.

(adunits.listLinkedCustomChannels)

Parameters

string $parent

Required. The ad unit which owns the collection of custom channels. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}

array $optParams

Optional parameters.

Return Value

ListLinkedCustomChannelsResponse

Exceptions

Exception

AdUnit patch(string $name, AdUnit $postBody, array $optParams = [])

Updates an ad unit. This method can be called only by a restricted set of projects, which are usually owned by AdSense for Platforms publishers.

Contact your account manager if you need to use this method. For now, this method can only be used to update DISPLAY ad units. See: https://support.google.com/adsense/answer/9183566 (adunits.patch)

Parameters

string $name

Output only. Resource name of the ad unit. Format: accounts/{account}/adclients/{adclient}/adunits/{adunit}

AdUnit $postBody
array $optParams

Optional parameters.

Return Value

AdUnit

Exceptions

Exception