ProductGroup

The base product group object, which contains the methods used to manage a product group.

Example usage:

    var shoppingCampaign = AdsApp.shoppingCampaigns().withIds(["123456789"]).get().next();

    var productGroups = shoppingCampaign.productGroups().get();

    while (productGroups.hasNext()) {
        var group = productGroups.next();
    }

Methods

Method Name Return Type Description
asBrand ProductBrand Casts the product group to a brand product group.
asCategory ProductCategory Casts the product group to a category product group.
asChannel ProductChannel Casts the product group to a channel product group.
asChannelExclusivity ProductChannelExclusivity Casts the product group to a channel exclusivity product group.
asCondition ProductCondition Casts the product group to a condition product group.
asCustomLabel ProductCustomLabel Casts the product group to a custom label product group.
asItemId ProductItemId Casts the product group to an item ID product group.
asProductType ProductType Casts the product group to a product type product group.
children ProductGroupSelector Gets a selector used to filter this product group's list of child product groups.
getAdGroup AdGroup Gets the ad group that this product group belongs to.
getCampaign Campaign Gets the campaign that this product group belongs to.
getDimension string Gets this product group's dimension.
getEntityType string Gets this entity's type.
getId string Gets the ID that uniquely identifies this product group.
getMaxCpc double Gets the maximum cost-per-click bid amount for this product group.
getStats Stats Gets the performance data for this product group.
getValue String Gets this product group's value.
isExcluded Boolean Gets a Boolean value that determines whether this product group is excluded.
isOtherCase Boolean Gets a Boolean value that determines whether this product group represents all other cases not represented by its sibling product group.
parent ProductGroup Gets this product group's parent product group.
setMaxCpc(double cpc) void Sets the maximum cost-per-click bid amount to use for this product group.

asBrand

Casts this product group to a brand product group.

Note

It's not necessary to cast the product group to a Brand product group to access the brand's value. You can access the brand's value by calling the getValue method.

Returns

Type Description
ProductBrand Contains the methods used to access the product group's properties.

asCategory

Casts this product group to a category product group.

Note

It's not necessary to cast the product group to a Category product group to access the category's value. You can access the category's value by calling the getValue method.

Returns

Type Description
ProductCategory Contains the methods used to access the product group's properties.

asChannel

Casts this product group to a Channel product group.

Note

It's not necessary to cast the product group to a Channel product group to access the channel's value. You can access the channel's value by calling the getValue method.

Returns

Type Description
ProductChannel Contains the methods used to access the product group's properties.

asChannelExclusivity

Casts this product group to a Channel Exclusivity product group.

Note

It's not necessary to cast the product group to a Channel Exclusivity product group to access the channel's value. You can access the channel's value by calling the getValue method.

Returns

Type Description
ProductChannelExclusivity Contains the methods used to access the product group's properties.

asCondition

Casts this product group to a condition product group.

Note

It's not necessary to cast the product group to a Condition product group to access the condition's value. You can access the condition's value by calling the getValue method.

Returns

Type Description
ProductCondition Contains the methods used to access the product group's properties.

asCustomLabel

Casts this product group to a custom label product group.

Note

It's not necessary to cast the product group to a CustomLabel product group to access the label's value. You can access the label's value by calling the getValue method. You only need to cast the product group to CustomLabel if you need to know which label type the value is for. For example, custom label 0 through 4.

Returns

Type Description
ProductCustomLabel Contains the methods used to access the product group's properties.

asItemId

Casts this product group to an item ID product group.

Note

It's not necessary to cast the product group to an ItemId product group to access the ID's value. You can access the ID's value by calling the getValue method.

Returns

Type Description
ProductItemId Contains the methods used to access the product group's properties.

asProductType

Casts this product group to a product type product group.

Note

It's not necessary to cast the product group to a ProductType product group to access the type's value. You can access the type's value by calling the getValue method. You only need to cast the product group to ProductType if you need to know which type the value is for. For example, PRODUCT_TYPE_L1, etc.

Returns

Type Description
ProductType Contains the methods used to access the product group's properties.

children

Gets a selector used to filter this product group's list of child product groups

Returns

Type Description
ProductGroupSelector A selector used to filter the list of children in this product group.

getAdGroup

Gets the ad group that this product group belongs to.

Returns

Type Description
AdGroup The ad group that this product group belongs to.

getCampaign

Gets the campaign that this product group belongs to.

Returns

Type Description
Campaign The campaign that this product group belongs to.

getDimension

Gets this product group's dimension.

Returns

Type Description
String This product group's dimension. Possible values are:
  • ROOT — The top of the tree
  • BRAND
  • CATEGORY
  • CONDITION
  • CUSTOM_LABEL
  • ITEM_ID
  • PRODUCT_TYPE

getEntityType

Gets this entity's type.

Returns

Type Description
string This entity's type, which is ProductGroup.

getId

Gets the ID that uniquely identifies this product group.

Returns

Type Description
string The ID that uniquely identifies this product group.

getMaxCpc

Gets this product group's maximum cost-per-click bid amount.

Returns

Type Description
double The bid amount. Returns null if not set or this is a negative product group (isExluded is true).

getStats

Gets the performance data for this product group.

To call this method, you must include one of the forDateRange methods in the product group selector's chain.

Returns:

Type Description
Stats The performance data for this product group.

getValue

Gets this product group's value.

Returns:

Type Description
String This product group's value. Returns null if this is the root group.

isExcluded

Gets a Boolean value that determines whether this product group is a negative product group.

Returns:

Type Description
Boolean Is true if this product group is a negative group; otherwise, false. For example, instead of including all downhill skis, you exclude them.

isOtherCase

Gets a Boolean value that determines whether this product group represents everything else not represented by its sibling product group (aka., the other case).

Returns:

Type Description
Boolean Is true if this product group represents the "other" case; otherwise, false. For example, if you divide All products (the root node) by Sporting Goods, the service creates a sibling product group that represents the products not in Sporting Goods and sets this field to true. The parent ID of this product group and the Sporting Goods product group point to the root node.

parent

Gets this product group's parent.

Returns:

Type Description
ProductGroup This product group's parent. Returns null if this is the root group.

setMaxCpc(double cpc)

Sets the maximum cost-per-click bid amount for this product group.

Arguments

Name Type Description
cpc double The bid amount. The bid amount is in the account's currency, which determines the minimum and maximum bid values you may specify. Do not set the bid if this product group is subdivided (has children) or is a negative product group (isExcluded is true).

Returns

Type Description
void Returns nothing.