Page Summary
-
Performance Max Campaigns can have ad schedules, location targets, and proximity targets added or excluded.
-
You can access and manage asset groups, bidding fields, labels, targeting criteria, and URL fields for a Performance Max Campaign.
-
Performance Max Campaigns can be enabled, paused, or checked for deletion status.
-
Information such as the campaign's bidding strategy type, budget, start and end dates, entity type, ID, name, and resource name are available.
-
Stats for a Performance Max Campaign can be retrieved for specified or custom date ranges.
Methods:
| Member | Type | Description |
|---|---|---|
AdsApp.AdScheduleOperation
|
Creates an ad schedule criterion from an ad schedule object. | |
AdsApp.AdScheduleOperation
|
Creates an ad schedule criterion. | |
AdsApp.TargetedLocationOperation
|
Creates a location target in this campaign from a location ID. | |
AdsApp.TargetedLocationOperation
|
Creates a location target in this campaign from a location. | |
AdsApp.TargetedLocationOperation
|
Creates a location target in this campaign from a location JSON. | |
AdsApp.TargetedLocationOperation
|
Creates a location target in this campaign from a location ID and bid modifier. | |
AdsApp.TargetedProximityOperation
|
Creates a proximity target in this campaign from a proximity object. | |
AdsApp.TargetedProximityOperation
|
Creates a proximity target in this campaign. | |
void
|
Applies a label to the performance max campaign. | |
AdsApp.AssetGroupSelector
|
Provides access to the asset groups attached to this performance max campaign. | |
AdsApp.PerformanceMaxCampaignBidding
|
Provides access to this performance max campaign's bidding fields. | |
void
|
Enables the performance max campaign. | |
AdsApp.ExcludedLocationOperation
|
Creates a location exclusion in this campaign. | |
AdsApp.ExcludedLocationOperation
|
Creates a location exclusion in this campaign. | |
AdsApp.ExcludedLocationOperation
|
Creates a location exclusion in this campaign. | |
String
|
Returns the bidding strategy type of the performance max campaign. | |
AdsApp.Budget
|
Returns the budget of the performance max campaign. | |
AdsApp.GoogleAdsDate
|
Returns the performance max campaign's end date, or null
if
there is no end date. |
|
String
|
Returns the type of this entity as a String
, in this case, "PerformanceMaxCampaign"
. |
|
String
|
Returns the ID of the performance max campaign. | |
String
|
Returns the name of the performance max campaign. | |
String
|
Returns the resource name of the performance max campaign. | |
AdsApp.GoogleAdsDate
|
Returns the performance max campaign's start date. | |
AdsApp.Stats
|
Returns stats for the specified date range. | |
AdsApp.Stats
|
Returns stats for the specified custom date range. | |
boolean
|
Returns true
if the performance max campaign is deleted. |
|
boolean
|
Returns true
if the performance max campaign is enabled. |
|
boolean
|
Returns true
if the performance max campaign is paused. |
|
AdsApp.LabelSelector
|
Creates a selector of all labels applied to the performance max campaign. | |
void
|
Pauses the performance max campaign. | |
void
|
Removes a label from the performance max campaign. | |
void
|
Sets the performance max campaign's end date from either an object
containing year, month, and day fields, or an 8-digit string in YYYYMMDD
format. |
|
void
|
Sets the name of the performance max campaign. | |
void
|
Sets the performance max campaign's start date from either an object
containing year, month, and day fields, or an 8-digit string in YYYYMMDD
format. |
|
AdsApp.CampaignTargeting
|
Provides access to campaign-level targeting criteria: device targeting, ad scheduling, location targeting, and audiences. | |
AdsApp.CampaignUrls
|
Provides access to this performance max campaign's URL fields. |
addAdSchedule(adSchedule)
Creates an ad schedule criterion from an ad schedule object. Once created,
the performance max campaign will start showing ads during the specified
time. When called with one argument, addAdSchedule
supports two
kinds of input:
- Existing AdSchedule
objects,
perhaps from another campaign:
var campaigns = AdsApp . performanceMaxCampaigns () . get (); var campaign1 = campaigns . next (); var campaign2 = campaigns . next (); var schedule = campaign1 . targeting () . adSchedules () . get () . next (); campaign2 . addAdSchedule ( schedule );
- Plain JavaScript objects describing an ad schedule. For instance,
this will create an ad schedule covering Saturday mornings:
This will look at the following properties of the given object:var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addAdSchedule ({ dayOfWeek : "SATURDAY" , startHour : 7 , startMinute : 0 , endHour : 11 , endMinute : 0 , bidModifier : 1.1 });
-
dayOfWeek: Required.Must be one of"MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY","SATURDAY", or"SUNDAY". -
startHourandstartMinute: Required.The starting time of this segment of the ad schedule.startHourmust be an integer between0and23, andstartMinutemust be either0,15,30, or45. For instance, astartHourof18and astartMinuteof30would result in an ad schedule starting at 6:30PM. Acceptable starting times range from00:00to23:45. -
endHourandendMinute: Required.The ending time of this segment of the ad schedule.endHourmust be an integer between0and24, andendMinutemust be either0,15,30, or45. For instance, aendHourof18and aendMinuteof30would result in an ad schedule ending at 6:30PM. Acceptable ending times range from00:15to24:00. -
bidModifier: Optional.The bid modifier for this segment of the ad schedule.
-
One thing to keep in mind is that, by default, campaigns have no ad schedule criteria and hence serve ads at all times. Adding the first ad schedule to a campaign will cause ads to be shown during that time only.
Arguments:
| Name | Type | Description |
|---|---|---|
|
adSchedule
|
Object
|
The schedule to create. |
Return values:
| Type | Description |
|---|---|
AdsApp.AdScheduleOperation
|
The associated ad schedule operation. |
addAdSchedule(dayOfWeek, startHour, startMinute, endHour, endMinute, bidModifier)
Creates an ad schedule criterion. Once created, the performance max
campaign will start showing ads during the specified time. For instance, this will create an ad schedule covering Saturday mornings:
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addAdSchedule ( "SATURDAY" , 7 , 0 , 11 , 0 );
This will create the same schedule, but with a bid modifier of 1.1
:
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addAdSchedule ( "SATURDAY" , 7 , 0 , 11 , 0 , 1.1 );
One thing to keep in mind is that, by default, campaigns have no ad schedule criteria and hence serve ads at all times. Adding the first ad schedule to a campaign will cause ads to be shown during that time only.
Arguments:
| Name | Type | Description |
|---|---|---|
|
dayOfWeek
|
String
|
The day of week. Must be one of "MONDAY"
, "TUESDAY"
, "WEDNESDAY"
, "THURSDAY"
, "FRIDAY"
, "SATURDAY"
, or "SUNDAY"
. |
|
startHour
|
int
|
The start hour. Must be an integer between 0
and 23
. Acceptable starting times range from 00:00
to 23:45
. |
|
startMinute
|
int
|
The start minute. Must be either 0
, 15
, 30
, or 45
. Acceptable
starting times range from 00:00
to 23:45
. |
|
endHour
|
int
|
The end hour. Must be an integer between 0
and 24
. Acceptable ending times range from 00:15
to 24:00
. |
|
endMinute
|
int
|
The end minute. Must be either 0
, 15
, 30
, or 45
. Acceptable ending
times range from 00:15
to 24:00
. |
|
bidModifier
|
double
|
Optional.The bid modifier to use for the newly created ad schedule. |
Return values:
| Type | Description |
|---|---|
AdsApp.AdScheduleOperation
|
The associated ad schedule operation. |
addLocation(locationId)
Creates a location target in this campaign from a location ID. Once
created, the campaign will start showing ads to the location with the given
location ID. You must specify a location ID. For a list of locations and their corresponding IDs, see the API documentation on geotargeting .
Arguments:
| Name | Type | Description |
|---|---|---|
|
locationId
|
int
|
The location ID to target. |
Return values:
| Type | Description |
|---|---|
AdsApp.TargetedLocationOperation
|
The associated targeted location operation. |
addLocation(location)
Creates a location target in this campaign from a location. Once created,
the campaign will start showing ads to the location with the given location
ID. You must specify an existing TargetedLocation object, perhaps from another campaign:
var campaigns = AdsApp . performanceMaxCampaigns () . get (); var campaign1 = campaigns . next (); var campaign2 = campaigns . next (); var location = campaign1 . targeting () . targetedLocations () . get () . next (); campaign2 . addLocation ( location );
Arguments:
| Name | Type | Description |
|---|---|---|
|
location
|
AdsApp.TargetedLocation
|
The location to target. |
Return values:
| Type | Description |
|---|---|
AdsApp.TargetedLocationOperation
|
The associated targeted location operation. |
addLocation(location)
Creates a location target in this campaign from a location JSON. Once
created, the campaign will start showing ads to the location with the given
location ID. You must specify a plain JavaScript object describing a location. For instance, this would create a location target for Tennessee:
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addLocation ({ id : 21175 , bidModifier : 1.2 , });
-
id: Required.The ID of the location to target. For a list of locations and their corresponding IDs, see the API documentation on geotargeting . -
bidModifier: Optional.The bid modifier for this location.
Arguments:
| Name | Type | Description |
|---|---|---|
|
location
|
Object
|
JSON representation of the location to target. |
Return values:
| Type | Description |
|---|---|
AdsApp.TargetedLocationOperation
|
The associated targeted location operation. |
addLocation(locationId, bidModifier)
Creates a location target in this campaign from a location ID and bid
modifier. Once created, the campaign will start showing ads to the location
with the given location ID. For instance, this will create a location target for Tennessee with a
bid modifier of 1.15
:
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addLocation ( 21175 , 1.15 );
Arguments:
| Name | Type | Description |
|---|---|---|
|
locationId
|
int
|
The ID of the location to target. For a list of locations and their corresponding IDs, see the API documentation on geotargeting . |
|
bidModifier
|
double
|
The desired bid modifier for the new location target. |
Return values:
| Type | Description |
|---|---|
AdsApp.TargetedLocationOperation
|
The associated targeted location operation. |
addProximity(proximity)
Creates a proximity target in this campaign from a proximity object. Once
created, the performance max campaign will start showing ads to
geographical points within the specified radius of the specified central
point. When called with one argument, addProximity
supports two
kinds of input:
- Existing TargetedProximity
objects, perhaps from another campaign:
var campaigns = AdsApp . performanceMaxCampaigns () . get (); var campaign1 = campaigns . next (); var campaign2 = campaigns . next (); var proximity = campaign1 . targeting () . targetedProximities () . get () . next (); campaign2 . addProximity ( proximity );
- Plain JavaScript objects describing a proximity. For instance, this
would create a proximity targeting 20km around Google headquarters:
This will look at the following properties of the given object:var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addProximity ({ latitude : 37.423021 , longitude : - 122.083739 , radius : 20 , radiusUnits : "KILOMETERS" , bidModifier : 0.75 , address : { streetAddress : "1600 Amphitheatre Parkway" , cityName : "Mountain View" , provinceName : "California" , provinceCode : "CA" , postalCode : "94043" , countryCode : "US" } });
-
latitudeandlongitude: Required.The central geographic point of the proximity to target. -
radiusandradiusUnits: Required.The radius around the central point to target.radiusUnitsmust be either"MILES"or"KILOMETERS". -
bidModifier: Optional.The bid modifier for this proximity. -
address: Optional.The address associated with the central geographical point.If present, this is expected to be an object, which contains any of
streetAddress,streetAddress2,cityName,provinceName,provinceCode,postalCode, andcountryCodeas properties with string values. This corresponds to the Address objects returned by existing proximity targets.There is no validation to check that the address actually belongs to the given latitude and longitude. It has no functionality except to change what shows up in the Campaign Management interface.
-
Arguments:
| Name | Type | Description |
|---|---|---|
|
proximity
|
Object
|
The proximity to target. |
Return values:
| Type | Description |
|---|---|
AdsApp.TargetedProximityOperation
|
The associated targeted proximity operation. |
addProximity(latitude, longitude, radius, radiusUnits, optArgs)
Creates a proximity target in this campaign. Once created, the performance
max campaign will start showing ads to geographical points within the
specified radius of the specified central point. For instance, this will create a proximity targeting 20km around Google headquarters:
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . addProximity ( 37.423021 , - 122.083739 , 20 , "KILOMETERS" );
campaign . addProximity ( 37.423021 , - 122.083739 , 20 , "KILOMETERS" , { bidModifier : 1.15 , address : { streetAddress : "1600 Amphitheatre Parkway" , cityName : "Mountain View" , provinceName : "California" , provinceCode : "CA" , postalCode : "94043" , countryCode : "US" } });
Arguments:
double
double
double
String
"MILES"
or "KILOMETERS"
.Object
For TargetedProximities
, there are two supported
optional arguments:
-
bidModifier: The bid modifier for this proximity. -
address: The address associated with the central geographical point.If present, this is expected to be an object, which contains any of
streetAddress,streetAddress2,cityName,provinceName,provinceCode,postalCode, andcountryCodeas properties with string values. This corresponds to the Address objects returned by existing proximity targets.There is no validation to check that the address actually belongs to the given latitude and longitude. It has no functionality except to change what shows up in the Campaign Management interface.
Return values:
| Type | Description |
|---|---|
AdsApp.TargetedProximityOperation
|
The associated targeted proximity operation. |
applyLabel(name)
Applies a label to the performance max campaign. name
of the label
is case-sensitive. Operation will fail if the label with the specified name
does not already exist in the account. Note that the performance max campaign cannot have more than 50 labels.
Returns nothing.
Arguments:
| Name | Type | Description |
|---|---|---|
|
name
|
String
|
Name of the label to apply. |
assetGroups()
Provides access to the asset groups attached to this performance max
campaign. Return values:
| Type | Description |
|---|---|
AdsApp.AssetGroupSelector
|
A selector of asset groups attached to this performance max campaign. |
bidding()
Provides access to this performance max campaign's bidding fields. Return values:
| Type | Description |
|---|---|
AdsApp.PerformanceMaxCampaignBidding
|
Access to this performance max campaign's bidding fields. |
enable()
Enables the performance max campaign. Returns nothing.
excludeLocation(locationId)
Creates a location exclusion in this campaign. Once created, the campaign
will not show ads to the location with the given location ID. You must specify a location ID. For a list of locations and their corresponding IDs, see the API documentation on geotargeting :
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . excludeLocation ( 21175 );
Arguments:
| Name | Type | Description |
|---|---|---|
|
locationId
|
int
|
The ID of the location to exclude. |
Return values:
| Type | Description |
|---|---|
AdsApp.ExcludedLocationOperation
|
The associated excluded location operation. |
excludeLocation(location)
Creates a location exclusion in this campaign. Once created, the campaign
will not show ads to the location with the given location ID. You must specify a plain JavaScript object describing a location. For instance, this would create a location exclusion for Tennessee:
var campaign = AdsApp . performanceMaxCampaigns () . get () . next (); campaign . excludeLocation ({ id : 21175 });
id
,
which represents the location ID. Arguments:
| Name | Type | Description |
|---|---|---|
|
location
|
Object
|
JSON representation of the location to exclude. |
Return values:
| Type | Description |
|---|---|
AdsApp.ExcludedLocationOperation
|
The associated excluded location operation. |
excludeLocation(location)
Creates a location exclusion in this campaign. Once created, the campaign
will not show ads to the location with the given location ID. You must specify an existing ExcludedLocation object, perhaps from another campaign:
var campaigns = AdsApp . performanceMaxCampaigns () . get (); var campaign1 = campaigns . next (); var campaign2 = campaigns . next (); var location = campaign1 . targeting () . excludedLocations () . get () . next (); campaign2 . excludeLocation ( location );
Arguments:
| Name | Type | Description |
|---|---|---|
|
location
|
AdsApp.ExcludedLocation
|
The location to exclude. |
Return values:
| Type | Description |
|---|---|
AdsApp.ExcludedLocationOperation
|
The associated excluded location operation. |
getBiddingStrategyType()
Returns the bidding strategy type of the performance max campaign. Possible
return values: MANUAL_CPC, MANUAL_CPM, TARGET_CPA, TARGET_SPEND, TARGET_ROAS,
MAXIMIZE_CONVERSIONS, MAXIMIZE_CONVERSION_VALUE,
TARGET_IMPRESSION_SHARE
Return values:
| Type | Description |
|---|---|
String
|
The bidding strategy type of the performance max campaign. |
getBudget()
Returns the budget of the performance max campaign. In order to change the
performance max campaign's budget, use Budget.setAmount(double)
. Return values:
| Type | Description |
|---|---|
AdsApp.Budget
|
Budget of the performance max campaign. |
getEndDate()
Returns the performance max campaign's end date, or null
if
there is no end date. For instance, if a campaign ended on May 3, 2013, this would return the
following object: {year: 2013, month: 5, day: 3}
.
Return values:
| Type | Description |
|---|---|
AdsApp.GoogleAdsDate
|
The performance max campaign's end date, or null
if
there's no end date. |
getEntityType()
Returns the type of this entity as a String
, in this case, "PerformanceMaxCampaign"
. Return values:
| Type | Description |
|---|---|
String
|
Type of this entity: "PerformanceMaxCampaign"
. |
getId()
Returns the ID of the performance max campaign. Return values:
| Type | Description |
|---|---|
String
|
The ID of the performance max campaign. |
getName()
Returns the name of the performance max campaign. Return values:
| Type | Description |
|---|---|
String
|
The name of the performance max campaign. |
getResourceName()
Returns the resource name of the performance max campaign. Return values:
| Type | Description |
|---|---|
String
|
The resource name of the performance max campaign. |
getStartDate()
Returns the performance max campaign's start date. For instance, if a campaign started on May 3, 2013, this would return
the following object: {year: 2013, month: 5, day: 3}
.
Return values:
| Type | Description |
|---|---|
AdsApp.GoogleAdsDate
|
The performance max campaign's start date. |
getStatsFor(dateRange)
Returns stats for the specified date range. Supported values: TODAY, YESTERDAY, LAST_7_DAYS, THIS_WEEK_SUN_TODAY, LAST_WEEK,
LAST_14_DAYS, LAST_30_DAYS, LAST_BUSINESS_WEEK, LAST_WEEK_SUN_SAT,
THIS_MONTH, LAST_MONTH, ALL_TIME
.
Example:
var stats = performanceMaxCampaign . getStatsFor ( "THIS_MONTH" );
Arguments:
| Name | Type | Description |
|---|---|---|
|
dateRange
|
String
|
Date range for which the stats are requested. |
Return values:
| Type | Description |
|---|---|
AdsApp.Stats
|
The stats for the specified date range. |
getStatsFor(dateFrom, dateTo)
Returns stats for the specified custom date range. Both parameters can be
either an object containing year, month, and day fields, or an 8-digit
string in YYYYMMDD
form. For instance, March 24th,
2013
is represented as either {year: 2013, month: 3, day:
24}
or "20130324"
. The date range is inclusive on both
ends, so forDateRange("20130324", "20130324")
defines a range
of a single day. Arguments:
| Name | Type | Description |
|---|---|---|
|
dateFrom
|
Object
|
Start date of the date range. Must be either a string in YYYYMMDD
form, or an object with year
, month
and day
properties. |
|
dateTo
|
Object
|
End date of the date range. Must be either a string in YYYYMMDD
form, or an object with year
, month
and day
properties. |
Return values:
| Type | Description |
|---|---|
AdsApp.Stats
|
The stats for the specified date range. |
isDeleted()
Returns true
if the performance max campaign is deleted. Return values:
| Type | Description |
|---|---|
boolean
|
true
if the performance max campaign is deleted. |
isEnabled()
Returns true
if the performance max campaign is enabled. Return values:
| Type | Description |
|---|---|
boolean
|
true
if the performance max campaign is enabled. |
isPaused()
Returns true
if the performance max campaign is paused. Return values:
| Type | Description |
|---|---|
boolean
|
true
if the performance max campaign is paused. |
labels()
Creates a selector of all labels applied to the performance max campaign. Return values:
| Type | Description |
|---|---|
AdsApp.LabelSelector
|
Selector of all labels applied to the performance max campaign. |
pause()
Pauses the performance max campaign. Returns nothing.
removeLabel(name)
Removes a label from the performance max campaign. name
of the
label is case-sensitive. Operation will fail if the label with the
specified name does not already exist in the account. Returns nothing.
Arguments:
| Name | Type | Description |
|---|---|---|
|
name
|
String
|
Name of the label. |
setEndDate(date)
Sets the performance max campaign's end date from either an object
containing year, month, and day fields, or an 8-digit string in YYYYMMDD
format. For instance, campaign.setEndDate("20130503");
is
equivalent to campaign.setEndDate({year: 2013, month: 5, day:
3});
.
The change will fail and report an error if:
- the given date is invalid (e.g.,
{year: 2013, month: 5, day: 55}), - it's a date in the past, or
- it's a date after the latest allowed end date of December 30, 2037.
Returns nothing.
Arguments:
| Name | Type | Description |
|---|---|---|
|
date
|
Object
|
The new campaign end date. |
setName(name)
Sets the name of the performance max campaign. Returns nothing.
Arguments:
| Name | Type | Description |
|---|---|---|
|
name
|
String
|
The new name for the performance max campaign. |
setStartDate(date)
Sets the performance max campaign's start date from either an object
containing year, month, and day fields, or an 8-digit string in YYYYMMDD
format. For instance, campaign.setStartDate("20130503");
is
equivalent to campaign.setStartDate({year: 2013, month: 5, day:
3});
.
The change will fail and report an error if:
- the performance max campaign has already started,
- the given date is invalid (e.g.,
{year: 2013, month: 5, day: 55}), - the given date is after the performance max campaign's end date,
- it's a date in the past, or
- it's a date after the latest allowed end date of December 30, 2037.
Returns nothing.
Arguments:
| Name | Type | Description |
|---|---|---|
|
date
|
Object
|
The new campaign end date. |
targeting()
Provides access to campaign-level targeting criteria: device targeting, ad
scheduling, location targeting, and audiences. Return values:
| Type | Description |
|---|---|
AdsApp.CampaignTargeting
|
Access to certain kinds of targeting criteria in this campaign. |
urls()
Provides access to this performance max campaign's URL fields. See Final URL
for
more information. Return values:
| Type | Description |
|---|---|
AdsApp.CampaignUrls
|
Access to this performance max campaign's URL fields. |

