Page Summary
-
An ExcludedLocation represents a Google Ads excluded location used to restrict ads from showing in specific geographic areas.
-
You can use an ExcludedLocation to exclude a specific city within a country where ads are generally targeted.
-
ExcludedLocation provides methods to retrieve information such as the associated campaign, campaign type, country code, ID, name, and targeting status.
-
You can get the base campaign, campaign, shopping campaign, or video campaign associated with the excluded location using dedicated methods.
-
The
remove()method allows you to remove an excluded location.
Excluded locations are used to restrict your ads from showing in specific geographic areas. For instance, a campaign could show ads in all parts of a country except for a specific city by having a TargetedLocation for the entire country and an ExcludedLocation for that specific city.
For more information on locations, see the API documentation on geotargeting .
See also TargetedLocation .
Methods:
| Member | Type | Description |
|---|---|---|
AdsApp.Campaign
|
Returns the base campaign to which this excluded location belongs. | |
AdsApp.Campaign
|
Returns the campaign to which this excluded location belongs or null
if it does not belong to a search or display campaign. |
|
String
|
Returns the campaign type. | |
String
|
Returns the country code of this location. | |
String
|
Returns the type of this entity as a String
, in this case, "ExcludedLocation"
. |
|
String
|
Returns the ID of the excluded location. | |
String
|
Returns the name of this location. | |
String
|
Returns the resource name of the excluded location. | |
AdsApp.ShoppingCampaign
|
Returns the shopping campaign to which this excluded location belongs or null
if it does not belong to a shopping campaign. |
|
String
|
Returns the target type of this location. | |
String
|
Returns the targeting status of this location. | |
AdsApp.VideoCampaign
|
Returns the video campaign to which this excluded location belongs or null
if it does not belong to a video campaign. |
|
void
|
Removes the excluded location. |
getBaseCampaign()
Returns the base campaign to which this excluded location belongs. Return values:
| Type | Description |
|---|---|
AdsApp.Campaign
|
The base campaign to which this excluded location belongs. |
getCampaign()
Returns the campaign to which this excluded location belongs or null
if it does not belong to a search or display campaign. Return values:
| Type | Description |
|---|---|
AdsApp.Campaign
|
The campaign to which this excluded location belongs or null
if it does
not belong to a search or display campaign. |
getCampaignType()
Returns the campaign type. Possible return values: SEARCH_OR_DISPLAY, VIDEO, SHOPPING
Return values:
| Type | Description |
|---|---|
String
|
Video campaign type. |
getCountryCode()
Returns the country code of this location. This is the standard two-letter country code, e.g. "US"
or "BR"
.
Return values:
| Type | Description |
|---|---|
String
|
The country code of this location. |
getEntityType()
Returns the type of this entity as a String
, in this case, "ExcludedLocation"
. Return values:
| Type | Description |
|---|---|
String
|
Type of this entity: "ExcludedLocation"
. |
getId()
Returns the ID of the excluded location. Location IDs are shared across campaigns. In order to uniquely identify a location exclusion, one must specify both its campaign ID and the location ID.
Return values:
| Type | Description |
|---|---|
String
|
The ID of the excluded location. |
getName()
Returns the name of this location. Return values:
| Type | Description |
|---|---|
String
|
The name of this location. |
getResourceName()
Returns the resource name of the excluded location. Return values:
| Type | Description |
|---|---|
String
|
The resource name of the excluded location. |
getShoppingCampaign()
Returns the shopping campaign to which this excluded location belongs or null
if it does not belong to a shopping campaign. Return values:
| Type | Description |
|---|---|
AdsApp.ShoppingCampaign
|
The shopping campaign to which this excluded location belongs or null
if
it does not belong to a shopping campaign. |
getTargetType()
Returns the target type of this location. The target type is a generic description of the location, such as "City"
, "Postal Code"
, or "Country"
.
For a full list of target types, see Geo targets
.
Return values:
| Type | Description |
|---|---|
String
|
The target type of this location. |
getTargetingStatus()
Returns the targeting status of this location. This can return one of three values:
-
"ACTIVE": indicates that the location can be targeted as normal. The vast majority of locations are active. -
"PHASING_OUT": indicates that the location can be targeted, but that support will soon be removed. To get a list of which locations are phasing out, see Geo targets . -
"OBSOLETE": indicates that the location cannot be targeted.
Return values:
| Type | Description |
|---|---|
String
|
The targeting status of this location. |
getVideoCampaign()
Returns the video campaign to which this excluded location belongs or null
if it does not belong to a video campaign. Return values:
| Type | Description |
|---|---|
AdsApp.VideoCampaign
|
The video campaign to which this excluded location belongs or null
if it
does not belong to a video campaign. |
remove()
Removes the excluded location. Returns nothing.

