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:
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:
Name | Type | Description |
name |
String |
The name of the additional item attribute. |
type |
String |
The type of the additional item attribute. |
Return values:
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:
Name | Type | Description |
attributes |
Object |
An object of the additional item attributes' names and
types. |
Return values:
build()
Builds the ad customizer source. Returns an
AdCustomizerSourceOperation
that corresponds to the creation of the
AdCustomizerSource.
Return values:
withName(name)
Sets the name of the new ad customizer source to the specified value. This
field is required.
Arguments:
Name | Type | Description |
name |
String |
The name of the ad customizer source. |
Return values: