AdsApp.​AdCustomizerSourceBuilder

Builder for AdCustomizerSource objects. For example, to create an ad customizer source with name "Inventory", and attributes "item" (of type text), "numLeft" (of type number), and "lowCost" (of type price):

var adCustomizerSourceBuilder = AdsApp.newAdCustomizerSourceBuilder();
var adCustomizerSourceOperation = adCustomizerSourceBuilder
  .withName("Inventory")             // required
  .addAttribute("item", "text")      // at least one attribute is required
  .addAttributes(
    {
      numLeft: "number",
      lowCost: "price"
    })
  .build();                          // create the ad customizer source

Methods:

MemberTypeDescription
addAttribute AdsApp.AdCustomizerSourceBuilder Adds an attribute of the given name and type to the new ad customizer source.
addAttributes AdsApp.AdCustomizerSourceBuilder Adds a set of attributes to the new ad customizer source.
build AdsApp.AdCustomizerSourceOperation Builds the ad customizer source.
withName AdsApp.AdCustomizerSourceBuilder Sets the name of the new ad customizer source to the specified value.

addAttribute(name, type)

Adds an attribute of the given name and type to the new ad customizer source. Existing attributes are not modified.

Valid types are text, number, price, date.

An error will be thrown if the additional attribute's name is one of start date, end date, device preference, scheduling, target campaign, target ad group, keyword text, match type, keyword, id, case insensitive.

An attribute named custom id (case insensitive) will be interpreted as a special attribute, which has the additional requirement of each item in the data source having unique value for that attribute.

Arguments:

NameTypeDescription
name String The name of the additional item attribute.
type String The type of the additional item attribute.

Return values:

TypeDescription
AdsApp.AdCustomizerSourceBuilder An ad customizer builder with an additional item attribute of the given name and type.

addAttributes(attributes)

Adds a set of attributes to the new ad customizer source. Existing attributes are not modified. The set of new attributes are specified by an object where the keys are the names and the values are the respective types of the attributes. For instance,

var attributes = {item: "text", numLeft: "number", lowCost: "price"};
var builder = AdsApp.newAdCustomizerSourceBuilder();
var adCustomizerSource = builder
    .withName("Inventory")
    .addAttributes(attributes)
    .build();
adds the attributes item (of type text), numLeft (of type number), and lowCost (of type price) to the new ad customizer data source named "Inventory".

Valid attribute types are text, number, price, date.

An error will be thrown if an additional attribute's name is one of start date, end date, device preference, scheduling, target campaign, target ad group, keyword text, match type, keyword, id, case insensitive.

Arguments:

NameTypeDescription
attributes Object An object of the additional item attributes' names and types.

Return values:

TypeDescription
AdsApp.AdCustomizerSourceBuilder An ad customizer builder with the additional item attributes specified.

build()

Builds the ad customizer source. Returns an AdCustomizerSourceOperation that corresponds to the creation of the AdCustomizerSource.

Return values:

TypeDescription
AdsApp.AdCustomizerSourceOperation The AdCustomizerSourceOperation.

withName(name)

Sets the name of the new ad customizer source to the specified value. This field is required.

Arguments:

NameTypeDescription
name String The name of the ad customizer source.

Return values:

TypeDescription
AdsApp.AdCustomizerSourceBuilder An ad customizer source builder with the specified name.