- Concepts
- Core Resources
Google Ads API
Unofficial Google Ads API client library for Node
Overview
Features
- Simple and easy-to-use API
- Uses gRPC and Protocol Buffers internally (recommended by Google)
- Typescript definitions for all Google Ads API resources, enums, and errors
Installation
$ yarn add google-ads-apiWhy does this library exist?
The official Google Ads client libraries are robust, but they don't always offer the most user-friendly developer interfaces, and their documentation can be confusing.
This library aims to offer a better way to use the Google Ads API.
- google-ads-node is a low-level Node implementation of the API, which imitates the stucture of the other client libraries.
- google-ads-api (this library) is a wrapper around
google-ads-nodeto provide a better developer experience.
Google Ads API versions
We aim to release new versions of this library within a few weeks of new API versions becoming available. These are the releases so far:
- v4.0 of the official google ads API: Versions
4.0.0and above of this library - v3.0 of the official google ads API: Versions
3.6.0to3.7.4of this library - v2.0 of the official google ads API: Versions
3.0.0to3.5.2of this library - v1.3 of the official google ads API: Versions
2.3.0to2.3.0of this library - v1.2 of the official google ads API: Versions
2.1.0to2.2.0of this library - v1.1 of the official google ads API: Versions
1.2.0to2.0.0of this library - v1.0 of the official google ads API: Versions
1.0.0to1.0.2of this library
Authentication
Before you can use the Google Ads API, you'll need to gather some authentication. You'll need:
- Client id and client secret: These are your OAuth credentials. You'll find them in your Google Cloud Console. If you don't already have these tokens, see google's instructions.
- Developer token: You'll find this in your Google Ads account, in the API Center. You will need to apply for one.
Then, for every Google Ads account you want to access, you'll need:
- Customer account ID: This is the CID of the account you want to access, which will look like
xxx-xxx-xxxx. - Login customer ID (only required if accessing the account via an MCC): This is usually the CID of the highest-level account in your MCC structure, also in the format
xxx-xxx-xxxx. - Linked customer ID : Only required for methods that update the resources of an entity when permissioned via Linked Accounts in the Google Ads UI. Read more
- Refresh token: You'll get this token when somebody authorises you to query their Google Ads account via OAuth. To get started, you can use https://refresh-token-helper.opteo.com/ to generate a single refresh token.
import { GoogleAdsApi } from 'google-ads-api'
const client = new GoogleAdsApi({
client_id: '<YOUR_CLIENT_ID>',
client_secret: '<YOUR_CLIENT_SECRET>',
developer_token: '<YOUR_DEVELOPER_TOKEN>',
})
const customer = client.Customer({
customer_account_id: '123-123-123',
login_customer_id: '456-456-456', // Optionally provide a login-customer-id
linked_customer_id: '789-789-789', // Optionally provide a linked-customer-id
refresh_token: '<YOUR_REFRESH_TOKEN>',
})
// If done correctly, you should now be able to list the campaigns in the account 123-123-123
customer.campaigns.list()Reporting
"Reporting" just means fetching data about an account.
All data in Google Ads is queriable via SQL-like tables. There is one table per resource (such as campaign or ad_group_ad).
These tables and their associated fields can be found in the core resources section of this page, or in the "API Fields"
section of the official docs.
Resources
There are four types of resources available for querying.
- Core Resources directly map to entities in your account. Example:
campaign,ad_group_criterion. - Criteria View Resources offer a more convenient way to query ad_group and campaign criteria (criteria are targeting options, such as keywords or placements). They may also aggregate metrics differently. Example:
keyword_viewis a subset of ad_group_criterion, whileage_range_viewis a subset of campaign_criterion. - Click & Search Term Resources are like core resources, except that they are by nature read-only. Example:
click_view,search_term_view. - Constant Resources are just a convenient way to query Google Ads constants (and their IDs). They aren't specific to your account. Example:
geo_target_constant,mobile_device_constant.
Fields
Resources contain three types of fields:
- Metrics hold data about the performance of your account, and change through time. Example:
metrics.clicksormetrics.historical_quality_score. - Segments allow you to segment your metrics by your chosen field, meaning your result will have more rows. Example:
segments.deviceorsegments.conversion_action. - Attributes are static information about a resource. All fields described in the core resources section of this page are attributes. It is not possible to query the past value of an attribute. Example:
campaign.nameorad_group_criterion.keyword.text.
Using GAQL
The customer.query() method allows you to query customer data using GAQL (Google Ads Query Language) query strings. This is great for prototyping and getting results out quickly.
GAQL looks like SQL, but it is not SQL. Key differences include:
- Very limited grammar (for example, no
ORin constraints). - Implicit joins when selecting
selectableWithfields. These aren't always intuitive. This file holds a complete list of which fields are usable for each resource.
// Basic query
const campaigns = await customer.query(`
SELECT
campaign.name, campaign.status
FROM
campaign
`)
// More complex query
const keyword_texts = await customer.query(`
SELECT
keyword_view.resource_name,
ad_group_criterion.keyword.text <-- This is an implicit join on ad_group_criterion
FROM
keyword_view <-- Main resource
WHERE
campaign.status = 'PAUSED' <-- This is another implicit join on campaign
AND metrics.impressions > 5
ORDER BY campaign.impressions
LIMIT 20
`)For a definition of the arguments and return types for customer.query(), see the customer core resource.
Using the query builder
The customer.report() method is a safer and more structured way to use GAQL. It's also more practical to use when your queries need to be built dynamically. If you are using typescript, it will give you handy autocomplete, too!
const response = await customer.report({
entity: 'ad_group',
attributes: ['ad_group.id', 'ad_group.name', 'ad_group.status'],
metrics: ['metrics.clicks'],
segments: ['segments.date'],
constraints: { 'ad_group.status': enums.AdGroupStatus.ENABLED },
from_date: '2019-01-01',
order_by: 'metrics.clicks',
sort_order: 'desc',
limit: 5,
})For full infomation on the arguments of customer.report(), see the customer core resource.
Every core resource also has get() and list() methods, which offer a convenient way to select every attribute of a resource. This can be quite valuable since GAQL does not support SELECT *. See the campaign core resource for an example.
Using Report Stream
The customer.reportStream() method is equivalent to customer.report(), except that it returns an async generator that you can use to access rows of data as they come back from the API.
Unlike report(), reportStream() does not support the page_size argument.
The main advantage of reportStream is performance. Not only are you able to get rows before the entire set has finished downloading, but the total time to finish the request will be shorter, especially for large requests (10,000+ rows).
Unfortunately, Google has hardwired the stream's chunk size to 10,000 rows, so there is no benefit to streaming for smaller requests. We're working with them to find a solution.
interface SearchTermView {
search_term_view: {
resource_name: string
search_term: string
}
metrics: {
clicks: number
}
}
const generator = customer.reportStream<SearchTermView>({
entity: 'search_term_view',
metrics: ['metrics.clicks'],
attributes: ['search_term_view.search_term'],
order_by: 'metrics.clicks',
sort_order: 'desc',
})
for await (let item of generator) {
// process each SearchTermView
}For full infomation on the arguments of customer.report(), see the customer core resource.
Every core resource also has get() and list() methods, which offer a convenient way to select every attribute of a resource. This can be quite valuable since GAQL does not support SELECT *. See the campaign core resource for an example.
Mutations
A "mutation" is a change to a Google Ads account, such as a new campaign or an adjusted bid.
Making changes using core resources
Most resources in the Google Ads API will have mutation methods for creating, updating, and deleting.
Create
The create method can take a single entity or array of entities. The results property of the response object will contain the newly created entity resource names.
const campaign = {
name: 'new-campaign',
campaign_budget: 'customers/123/campaignBudgets/123',
advertising_channel_type: enums.AdvertisingChannelType.SEARCH,
status: enums.CampaignStatus.PAUSED,
}
const { results } = await customer.campaigns.create(campaign)
console.log(results) // ['customers/123/campaigns/456'] <-- new resource_nameFor more details on this method, check the create() section for the core resource you want to create, such as creating a campaign.
Update
The update method works the same way as create and takes a single entity or array of entities to update. All properties passed (that can be updated) will be updated, so if you don't want to update an attribute, don't include it.
The results property of the response object will contain the updated entity resource names.
const campaign = {
resource_name: `customers/123/campaigns/456`,
name: 'updated-campaign-name',
}
const { results } = await customer.campaigns.update(campaign)For more details on this method, check the update() section for the core resource you want to modify, such as updating a campaign.
Delete
The delete method should be provided with the resource name of the entity to remove. Note: When deleting an entity in the Google Ads API, it will continue to exist, but it will be immutable and its status will be changed to REMOVED.
await customer.campaigns.delete('customers/123/campaigns/456')For more details on this method, check the delete() section for the core resource you want to delete, such as deleting a campaign.
Atomic mutations using customer.mutateResources()
Sometimes you may want to create multiple resources of different types at once, such as creating a new campaign and its required budget. The customer.mutateResources method is designed for this use case, and supports:
- Atomic Mutations: If any of the operations fail, all other operations will be rolled back.
- Temporary Resource IDs: Define your entity relationships using your own temporary IDs.
- All Mutation Types: Create, update, and delete resources.
A basic example of creating a budget, and a campaign that uses this budget, is shown below:
const { results } = await customer.mutateResources([
{
// For each resource, you must specify its type with the "_resource" key
_resource: 'CampaignBudget',
resource_name: `customers/123/campaignBudgets/-1`, // We define the new ID as -1
name: 'My new budget',
amount_micros: 3000000,
explicitly_shared: true,
},
{
_resource: 'Campaign',
campaign_budget: `customers/123/campaignBudgets/-1`, // Reference to the budget above
name: 'My new campaign',
advertising_channel_type: enums.AdvertisingChannelType.SEARCH,
status: enums.CampaignStatus.PAUSED,
manual_cpc: {
enhanced_cpc_enabled: true,
},
// We don't need to set a temporary resource name here because
// nothing else in this operations array depends on this campaign
},
])
// The real resource ids will now be defined after performing the operation
console.log(results) // ['customers/123/campaignBudgets/123123', 'customers/123/campaigns/321321']By default, mutateResources is atomic and will rollback if one operation fails -- no new resources will be added to the client account if one operation fails. This mode can be disabled by setting the partial_failure option to true. The validate_only option is also supported in this method. See the Google Ads API documentation for more details on these settings.
await customer.mutateResources(operations, { partial_failure: true })As well as creating resources, mutateResources also supports updating and deleting multiple resources (which also works with temporary resource ids). Use the _operation field in an operation to specify the mode, being either create, update or delete. This field isn't required and defaults to create. In the example below, these operations are executed:
- A new budget with the temporary resource id
-1is created. - An existing campaign (id of
456) is updated to use the new budget (-1). - The original budget used by the campaign is deleted.
const response = await customer.mutateResources([
// Create new budget
{
_resource: 'CampaignBudget',
_operation: 'create',
resource_name: 'customers/123/campaignBudgets/-1',
name: 'My new budget',
amount_micros: 3000000,
explicitly_shared: true,
},
// Update campaign to use new budget
{
_resource: 'Campaign',
_operation: 'update',
resource_name: 'customers/123/campaigns/456',
campaign_budget: 'customers/123/campaignBudgets/-1', // Reference to budget above
},
// Delete old budget
{
_resource: 'CampaignBudget',
_operation: 'delete',
resource_name: 'customers/123/campaignBudgets/123123',
},
])Note: Using customer.mutateResources() with a single operation is equivalent to using any of the standard customer.someResource.create|update|delete() methods, but your ts definitions won't be as good.
For more information about this method, see the customer resource's mutateResources section.
Enums
All enums are represented as numbers in the Google Ads API. This means:
- Numbers must be used for enums when making mutate calls (create, update, delete).
- Reports will include numbers instead of strings for enum fields.
For example:
/*
campaign.status can have a few states:
"UNSPECIFIED" = 0
"UNKNOWN" = 1
"ENABLED" = 2
"PAUSED" = 3
"REMOVED" = 4
*/
const campaigns = await customer.query(`SELECT campaign.status FROM campaign`)
if (campaigns[0].campaign.status === 2) {
// the campaign is enabled
}
const campaign_to_update = {
resource_name: `customers/123/campaigns/123`,
status: 3,
}
await customer.campaigns.update(campaign) // This will set the status to "PAUSED"Of course, using numbers directly isn't convenient. Instead, use the enums import:
import { enums } from 'google-ads-api'
const campaigns = await customer.query(`SELECT campaign.status FROM campaign`)
if (campaigns[0].campaign.status === enums.CampaignStatus.ENABLED) {
// the campaign is enabled
}
const campaign_to_update = {
resource_name: `customers/123/campaigns/123`,
status: enums.CampaignStatus.PAUSED,
}
await customer.campaigns.update(campaign) // This will set the status to "PAUSED"The enums.ts file (found in our companion library) lists out all enums available in the Google Ads API. For example:
// Note that this will be compiled to an object by typescript.
export enum AdvertisingChannelType {
'UNSPECIFIED' = 0,
'UNKNOWN' = 1,
'SEARCH' = 2,
'DISPLAY' = 3,
'SHOPPING' = 4,
'HOTEL' = 5,
'VIDEO' = 6,
'MULTI_CHANNEL' = 7,
}GAQL, on the other hand, expects strings for enums in constraints:
customer.query(`
SELECT
ad_group_ad.id
FROM
ad_group_ad
WHERE
campaign.status = "ENABLED" <-- works!
campaign.status = ENABLED <-- also works (for enums)
campaign.status = 2 <-- will not work
`)- When using
customer.query(), you must use strings. - When using
customer.report(), both strings and numbers are supported.
Handling Errors with Enums
To handle errors from the Google Ads API, the best approach is to use the provided error enums, available with the enums import. A full list of error types can be found in the Google Ads API reference.
import { enums } from 'google-ads-api'
try {
const campaigns = await customer.report({
entity: 'campaign',
attributes: ['ad_group_criterion.keyword.text'],
})
} catch (err) {
if (err.code.queryError === enums.QueryError.PROHIBITED_RESOURCE_TYPE_IN_SELECT_CLAUSE) {
// Handle error case..
}
// Besides `code`, errors have other useful metadata:
console.log(err.message) // "Cannot select fields from the following resource.."
console.log(err.location) // "ad_group_criterion.keyword.text"
console.log(err.request_id) // "5Tzsyp_M_9F7oHl_EZh8Ow", useful when discussing issues with Google support
console.log(err.request) // Request protocol buffer body in readable format, useful for debugging
console.log(err.failure) // gRPC GoogleAdsFailure instance
}Utilities
This library exports a set of helper methods that can assist you during development.
fromMicros: Converts micro value to a normal number.toMicros: Converts a normal number to a micro value.getEnumString: Get the value of an enum as a string (instead of the default number value).
import { fromMicros, toMicros, getEnumString /* , enums, types, GoogleAdsApi */ } from 'google-ads-api'
fromMicros(123300000) // 123.3
toMicros(123.3) // 123300000
// You must pass the enum name and the value
getEnumString('AdvertisingChannelType', enums.AdvertisingChannelType.DISPLAY) // "DISPLAY"
getEnumString('AdvertisingChannelType', 3) // "DISPLAY"Typescript
This library has first-class support for Typescript. We also expose every single type in the Google Ads API via the types export, should you choose to use them in your own code:
import { types } from 'google-ads-api'
const campaign: types.Campaign = {
id: 123123,
some_wrong_field: false, // The type checker won't allow this.
name: [1, 2, 3], // `name` should be a string, so this will also throw an error.
}The resources.ts file (found in our companion library) is a good reference for all exported types. For example, you'll find:
// Example interface for the v2 common "TextAdInfo" entity in the Google Ads API
/* .google.ads.googleads.v2.common.TextAdInfo */
export interface TextAdInfo {
headline?: string
description_1?: string
description_2?: string
}Changelog
This library's changelog: https://github.com/Opteo/google-ads-api/blob/master/CHANGELOG.md
Official API changelog: Google Ads API release notes
We do not yet support every feature of the Google Ads API. Currently, these parts are missing:
- Uploading click and call conversions
- Adjusting conversion via uploads
- Listing accessible MCC customers
- Creating new customers
- Generating new keyword ideas
- Using keywordPlans to generate forecasts
- Listing Merchant Center links
- Using the MutateJobService
- Listing payment accounts
- Applying and dismissing Google's recommendations
If any of these features are important to you, help us prioritise by opening an issue on GitHub!
FAQ
I'm getting errors that my bids or budgets are too small. Why?
All monetary values are set and fetched in micros. These are 1,000,000x bigger than the actual amount. Use our utility functions toMicros and fromMicros to convert.
Where are my keywords? Keywords are hidden away in AdGroupCriterion -> keyword. Keywords are just one of many types of targeting "Criteria", meaning they modify the targeting of ads.
Can I run this in a browser? No. There's no way to hide your tokens without using a proxy, which would need to be on your server anyway.
Can I run this in a serverless environment (Lambda, etc.)? Yes. Note that this library uses several NodeJS native methods (fs, crypto), so webworker-like environments such as CloudFlare workers won't function.
When Google releases their own Node client for Google Ads, will this library still be relevant? Yes. We've already auto-generated a client with Google's protocol buffers, called google-ads-node. It's very feature complete, and this library is built on top of it. When Google releases their own node client, we may deprecate google-ads-node and refractor this library to use it instead.
Do you have any examples on how to use this library? We're working on a robust set of examples. You can find the ones we've already completed in this branch.
Core resources
Fields
- adjusted_spending_limit_micros int64
- adjusted_spending_limit_type enum
- approved_end_date_time string
- approved_end_time_type enum
- approved_spending_limit_micros int64
- approved_spending_limit_type enum
- proposed_end_date_time string
- proposed_end_time_type enum
- proposed_spending_limit_micros int64
- proposed_spending_limit_type enum
customers/{customer_id}/billingSetups/{billing_setup_id}customers/{customer_id}/accountBudgets/{account_budget_id}// Example AccountBudget
const account_budget = {
adjusted_spending_limit_type: 2,
amount_served_micros: 227337890000,
approved_end_time_type: 3,
approved_spending_limit_type: 2,
approved_start_date_time: '2017-01-01 12:22:14',
billing_setup: 'customers/3827277046/billingSetups/295854200',
id: 295854560,
name: '',
proposed_end_time_type: 3,
proposed_spending_limit_type: 2,
proposed_start_date_time: '2017-01-01 12:22:14',
resource_name: 'customers/3827277046/accountBudgets/295854560',
status: 3,
total_adjustments_micros: 1176390000,
}Get an AccountBudget
The customer.accountBudgets.get(resource_name) method returns the AccountBudget identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AccountBudget
Returns
Returns that AccountBudget as an object.
// Getting the entity
let result = await customer.accountBudgets.get('customers/3827277046/accountBudgets/295854560')// Example result
;({
adjusted_spending_limit_type: 2,
amount_served_micros: 227337890000,
approved_end_time_type: 3,
approved_spending_limit_type: 2,
approved_start_date_time: '2017-01-01 12:22:14',
billing_setup: 'customers/3827277046/billingSetups/295854200',
id: 295854560,
name: '',
proposed_end_time_type: 3,
proposed_spending_limit_type: 2,
proposed_start_date_time: '2017-01-01 12:22:14',
resource_name: 'customers/3827277046/accountBudgets/295854560',
status: 3,
total_adjustments_micros: 1176390000,
})List every instance of AccountBudget
The customer.accountBudgets.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AccountBudget.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a account_budget property. Any other resources that can be selected with account_budget will also be added as properities.
// Listing all the accountBudgets in the account
let result = await customer.accountBudgets.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.accountBudgets.list({
constraints: [
{
key: 'account_budget.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'account_budget.some_field.sub_field',
})// Example result
;[
{
account_budget: {
adjusted_spending_limit_type: 2,
amount_served_micros: 227337890000,
approved_end_time_type: 3,
approved_spending_limit_type: 2,
approved_start_date_time: '2017-01-01 12:22:14',
billing_setup: 'customers/3827277046/billingSetups/295854200',
id: 295854560,
name: '',
proposed_end_time_type: 3,
proposed_spending_limit_type: 2,
proposed_start_date_time: '2017-01-01 12:22:14',
resource_name: 'customers/3827277046/accountBudgets/295854560',
status: 3,
total_adjustments_micros: 1176390000,
},
billing_setup: {
end_time_type: 3,
id: 295854200,
payments_account: 'customers/3827277046/paymentsAccounts/2445-9502-2490-5474',
payments_account_info: {
payments_account_id: '2445-9502-2490-5474',
payments_account_name: 'AdWords 382-727-7046',
payments_profile_id: '4466-6664-9412',
payments_profile_name: 'Opteo LTD',
},
resource_name: 'customers/3827277046/billingSetups/295854200',
start_date_time: '2017-01-01 12:22:14',
status: 4,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]AccountBudgetProposal
The AccountBudgetProposal object
Fields
- approved_end_date_time string
- approved_end_time_type enum
- approved_spending_limit_micros int64
- approved_spending_limit_type enum
- proposed_end_date_time string
- proposed_end_time_type enum
- proposed_spending_limit_micros int64
- proposed_spending_limit_type enum
- proposed_start_date_time string
- proposed_start_time_type enum
customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}// Example AccountBudgetProposal
const account_budget_proposal = {
account_budget: 'customers/3827277046/accountBudgets/295854560',
approval_date_time: '2017-01-01 12:25:18',
approved_end_time_type: 3,
approved_spending_limit_type: 2,
approved_start_date_time: '2017-01-01 12:22:14',
billing_setup: 'customers/3827277046/billingSetups/295854200',
creation_date_time: '2017-01-01 12:25:18',
id: 265265547,
proposal_type: 0,
proposed_end_time_type: 3,
proposed_name: '',
proposed_spending_limit_type: 2,
proposed_start_date_time: '2017-01-01 12:22:14',
resource_name: 'customers/3827277046/accountBudgetProposals/265265547',
status: 4,
}Get an AccountBudgetProposal
The customer.accountBudgetProposals.get(resource_name) method returns the AccountBudgetProposal identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AccountBudgetProposal
Returns
Returns that AccountBudgetProposal as an object.
// Getting the entity
let result = await customer.accountBudgetProposals.get('customers/3827277046/accountBudgetProposals/265265547')// Example result
;({
account_budget: 'customers/3827277046/accountBudgets/295854560',
approval_date_time: '2017-01-01 12:25:18',
approved_end_time_type: 3,
approved_spending_limit_type: 2,
approved_start_date_time: '2017-01-01 12:22:14',
billing_setup: 'customers/3827277046/billingSetups/295854200',
creation_date_time: '2017-01-01 12:25:18',
id: 265265547,
proposal_type: 0,
proposed_end_time_type: 3,
proposed_name: '',
proposed_spending_limit_type: 2,
proposed_start_date_time: '2017-01-01 12:22:14',
resource_name: 'customers/3827277046/accountBudgetProposals/265265547',
status: 4,
})List every instance of AccountBudgetProposal
The customer.accountBudgetProposals.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AccountBudgetProposal.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a account_budget_proposal property. Any other resources that can be selected with account_budget_proposal will also be added as properities.
// Listing all the accountBudgetProposals in the account
let result = await customer.accountBudgetProposals.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.accountBudgetProposals.list({
constraints: [
{
key: 'account_budget_proposal.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'account_budget_proposal.some_field.sub_field',
})// Example result
;[
{
account_budget_proposal: {
account_budget: 'customers/3827277046/accountBudgets/295854560',
approval_date_time: '2017-01-01 12:25:18',
approved_end_time_type: 3,
approved_spending_limit_type: 2,
approved_start_date_time: '2017-01-01 12:22:14',
billing_setup: 'customers/3827277046/billingSetups/295854200',
creation_date_time: '2017-01-01 12:25:18',
id: 265265547,
proposal_type: 0,
proposed_end_time_type: 3,
proposed_name: '',
proposed_spending_limit_type: 2,
proposed_start_date_time: '2017-01-01 12:22:14',
resource_name: 'customers/3827277046/accountBudgetProposals/265265547',
status: 4,
},
billing_setup: {
end_time_type: 3,
id: 295854200,
payments_account: 'customers/3827277046/paymentsAccounts/2445-9502-2490-5474',
payments_account_info: {
payments_account_id: '2445-9502-2490-5474',
payments_account_name: 'AdWords 382-727-7046',
payments_profile_id: '4466-6664-9412',
payments_profile_name: 'Opteo LTD',
},
resource_name: 'customers/3827277046/billingSetups/295854200',
start_date_time: '2017-01-01 12:22:14',
status: 4,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AccountBudgetProposal
The customer.accountBudgetProposals.create(account_budget_proposal) method makes a new AccountBudgetProposal in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AccountBudgetProposal object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const account_budget_proposal = {
// Your AccountBudgetProposal here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.accountBudgetProposals.create(account_budget_proposal)
// Passing in an array of entities to create, validating only
const result = await customer.accountBudgetProposals.create([account_budget_proposal, other_account_budget_proposal], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/accountBudgetProposals/265265547'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AccountBudgetProposal
The customer.accountBudgetProposals.update(account_budget_proposal) method changes the attributes of an existing accountBudgetProposals in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AccountBudgetProposal object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const account_budget_proposal = {
resource_name: 'customers/3827277046/accountBudgetProposals/265265547', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.accountBudgetProposals.update(account_budget_proposal)
// Passing in an array of entities to update, validating only
const result = await customer.accountBudgetProposals.update([account_budget_proposal, other_account_budget_proposal], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/accountBudgetProposals/265265547'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AccountBudgetProposal
The customer.accountBudgetProposals.delete(resource_name) sets the status field of an AccountBudgetProposal to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AccountBudgetProposal
Returns
Nothing
// Deleting the entity
await customer.accountBudgetProposals.delete('customers/3827277046/accountBudgetProposals/265265547')Ad
Not to be confused with AdGroupAd, this entity only has two methods: get and update. It allows you to edit the creative part of an ad, such as the headline, description, or image. Editing an ad this way will not reset the metrics of the ad.
The Ad object
Fields
- app_ad objectDetails pertaining to an app ad.
- app_engagement_ad objectDetails pertaining to an app engagement ad.
- call_only_ad objectDetails pertaining to a call-only ad.
- display_upload_ad objectDetails pertaining to a display upload ad.
- expanded_dynamic_search_ad objectImmutable. Details pertaining to an Expanded Dynamic Search Ad. This type of ad has its headline, final URLs, and display URL auto-generated at serving time according to domain name specific information provided by
dynamic_search_ads_settinglinked at the campaign level. - expanded_text_ad objectDetails pertaining to an expanded text ad.
- gmail_ad objectImmutable. Details pertaining to a Gmail ad.
- hotel_ad objectDetails pertaining to a hotel ad.
- image_ad objectImmutable. Details pertaining to an Image ad.
- legacy_app_install_ad objectImmutable. Details pertaining to a legacy app install ad.
- legacy_responsive_display_ad objectDetails pertaining to a legacy responsive display ad.
- local_ad objectDetails pertaining to a local ad.
- responsive_display_ad objectDetails pertaining to a responsive display ad.
- responsive_search_ad objectDetails pertaining to a responsive search ad.
- shopping_comparison_listing_ad objectDetails pertaining to a Shopping Comparison Listing ad.
- shopping_product_ad objectDetails pertaining to a Shopping product ad.
- shopping_smart_ad objectDetails pertaining to a Smart Shopping ad.
- text_ad objectImmutable. Details pertaining to a text ad.
- video_ad objectDetails pertaining to a Video ad.
customers/{customer_id}/ads/{ad_id}tracking_url_template, final_urls, or mobile_final_urls. For mutates, please use url custom parameter operations.// Example Ad
const ad = {
added_by_google_ads: false,
display_url: '',
expanded_text_ad: {
description: 'my description here',
headline_part1: 'headline part 1 here',
headline_part2: 'headline part 2 here',
path1: 'path one here',
path2: 'path two here',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['http://hello.com'],
id: 284706472002,
resource_name: 'customers/9262111890/ads/284706472002',
type: 3,
url_collections: [],
url_custom_parameters: [],
}Get an Ad
The customer.ads.get(resource_name) method returns the Ad identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Ad
Returns
Returns that Ad as an object.
// Getting the entity
let result = await customer.ads.get('customers/9262111890/ads/284706472002')// Example result
;({
added_by_google_ads: false,
display_url: '',
expanded_text_ad: {
description: 'my description here',
headline_part1: 'headline part 1 here',
headline_part2: 'headline part 2 here',
path1: 'path one here',
path2: 'path two here',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['http://hello.com'],
id: 284706472002,
resource_name: 'customers/9262111890/ads/284706472002',
type: 3,
url_collections: [],
url_custom_parameters: [],
})List every instance of Ad
The customer.ads.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Ad.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad property. Any other resources that can be selected with ad will also be added as properities.
// Listing all the ads in the account
let result = await customer.ads.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.ads.list({
constraints: [
{
key: 'ad.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad.some_field.sub_field',
})// Example result
;[
/* Todo: add example list() return here */
]Create an Ad
The customer.ads.create(ad) method makes a new Ad in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Ad object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad = {
// Your Ad here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.ads.create(ad)
// Passing in an array of entities to create, validating only
const result = await customer.ads.create([ad, other_ad], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/ads/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an Ad
The customer.ads.update(ad) method changes the attributes of an existing ad in an account. It also supports an array as its first agument for batch operations. Updating an ad using this method will not reset its metrics.
Arguments
-
entity required
The Ad object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad = {
resource_name: 'customers/1234567890/ads/123123123', // The resource_name is required
final_urls : ['https://updated-url.com']
expanded_text_ad: {
headline_part1: 'updated headline here',
},
}
// Passing in a single entity to update
const result = await customer.ads.update(ad)
// Passing in an array of entities to update, validating only
const result = await customer.ads.update([ad, other_ad], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/ads/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an Ad
The customer.ads.delete(resource_name) sets the status field of an Ad to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that Ad
Returns
Nothing
// Deleting the entity
await customer.ads.delete('customers/1234567890/ads/123123123')AdGroup
The AdGroup object
Fields
customers/{customer_id}/adGroups/{ad_group_id}tracking_url_template, final_urls, or mobile_final_urls.// Example AdGroup
const ad_group = {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/56761341338',
campaign: 'customers/3827277046/campaigns/1398201241',
cpc_bid_micros: 6000000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas: 4,
effective_target_roas_source: 5,
explorer_auto_optimizer_setting: { opt_in: false },
id: 56761341338,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/56761341338',
status: 3,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 13,
url_custom_parameters: [],
}Get an AdGroup
The customer.adGroups.get(resource_name) method returns the AdGroup identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroup
Returns
Returns that AdGroup as an object.
// Getting the entity
let result = await customer.adGroups.get('customers/3827277046/adGroups/56761341338')// Example result
;({
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/56761341338',
campaign: 'customers/3827277046/campaigns/1398201241',
cpc_bid_micros: 6000000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas: 4,
effective_target_roas_source: 5,
explorer_auto_optimizer_setting: { opt_in: false },
id: 56761341338,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/56761341338',
status: 3,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 13,
url_custom_parameters: [],
})List every instance of AdGroup
The customer.adGroups.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroup.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group property. Any other resources that can be selected with ad_group will also be added as properities.
// Listing all the adGroups in the account
let result = await customer.adGroups.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroups.list({
constraints: [
{
key: 'ad_group.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group.some_field.sub_field',
})// Example result
;[
{
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/56761341338',
campaign: 'customers/3827277046/campaigns/1398201241',
cpc_bid_micros: 6000000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas: 4,
effective_target_roas_source: 5,
explorer_auto_optimizer_setting: { opt_in: false },
id: 56761341338,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/56761341338',
status: 3,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 13,
url_custom_parameters: [],
},
bidding_strategy: {
campaign_count: 3,
id: 2053936084,
name: 'My bidding strategy',
non_removed_campaign_count: 3,
resource_name: 'customers/3827277046/biddingStrategies/2053936084',
status: 2,
target_roas: { cpc_bid_ceiling_micros: 8000000, target_roas: 4 },
type: 8,
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/1398201241',
bidding_strategy: 'customers/3827277046/biddingStrategies/2053936084',
bidding_strategy_type: 8,
campaign_budget: 'customers/3827277046/campaignBudgets/1453179506',
dynamic_search_ads_setting: {
domain_name: 'opteo.com',
feeds: [],
language_code: 'en',
use_supplied_urls_only: false,
},
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1398201241,
labels: [
'customers/3827277046/labels/3889728216',
'customers/3827277046/labels/3889728468',
'customers/3827277046/labels/3889728474',
],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/1398201241',
serving_status: 2,
start_date: '2018-05-10',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AdGroup
The customer.adGroups.create(ad_group) method makes a new AdGroup in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroup object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group = {
// Your AdGroup here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroups.create(ad_group)
// Passing in an array of entities to create, validating only
const result = await customer.adGroups.create([ad_group, other_ad_group], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroups/56761341338'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroup
The customer.adGroups.update(ad_group) method changes the attributes of an existing adGroups in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroup object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group = {
resource_name: 'customers/3827277046/adGroups/56761341338', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroups.update(ad_group)
// Passing in an array of entities to update, validating only
const result = await customer.adGroups.update([ad_group, other_ad_group], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroups/56761341338'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroup
The customer.adGroups.delete(resource_name) sets the status field of an AdGroup to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroup
Returns
Nothing
// Deleting the entity
await customer.adGroups.delete('customers/3827277046/adGroups/56761341338')AdGroupAd
The AdGroupAd object
Fields
customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}// Example AdGroupAd
const ad_group_ad = {
ad: {
added_by_google_ads: false,
device_preference: 0,
expanded_text_ad: {
description: 'my description here2',
headline_part1: 'headline part 1 here2',
headline_part2: 'headline part 2 here2',
path1: 'path one here2',
path2: 'path two here2',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['http://hello.com'],
id: 284706472002,
resource_name: 'customers/9262111890/ads/284706472002',
system_managed_resource_source: 0,
type: 3,
url_collections: [],
url_custom_parameters: [],
},
ad_group: 'customers/9262111890/adGroups/56328868446',
ad_strength: 0,
policy_summary: { approval_status: 0, policy_topic_entries: [], review_status: 2 },
resource_name: 'customers/9262111890/adGroupAds/56328868446~284706472002',
status: 2,
}Get an AdGroupAd
The customer.adGroupAds.get(resource_name) method returns the AdGroupAd identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupAd
Returns
Returns that AdGroupAd as an object.
// Getting the entity
let result = await customer.adGroupAds.get('customers/9262111890/adGroupAds/56328868446~284706472002')// Example result
;({
ad: {
added_by_google_ads: false,
device_preference: 0,
expanded_text_ad: {
description: 'my description here2',
headline_part1: 'headline part 1 here2',
headline_part2: 'headline part 2 here2',
path1: 'path one here2',
path2: 'path two here2',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['http://hello.com'],
id: 284706472002,
resource_name: 'customers/9262111890/ads/284706472002',
system_managed_resource_source: 0,
type: 3,
url_collections: [],
url_custom_parameters: [],
},
ad_group: 'customers/9262111890/adGroups/56328868446',
ad_strength: 0,
policy_summary: { approval_status: 0, policy_topic_entries: [], review_status: 2 },
resource_name: 'customers/9262111890/adGroupAds/56328868446~284706472002',
status: 2,
})List every instance of AdGroupAd
The customer.adGroupAds.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupAd.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_ad property. Any other resources that can be selected with ad_group_ad will also be added as properities.
// Listing all the adGroupAds in the account
let result = await customer.adGroupAds.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupAds.list({
constraints: [
{
key: 'ad_group_ad.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_ad.some_field.sub_field',
})// Example result
;[
{
ad_group_ad: {
ad: {
added_by_google_ads: false,
device_preference: 0,
expanded_text_ad: {
description: 'my description here2',
headline_part1: 'headline part 1 here2',
headline_part2: 'headline part 2 here2',
path1: 'path one here2',
path2: 'path two here2',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['http://hello.com'],
id: 284706472002,
resource_name: 'customers/9262111890/ads/284706472002',
system_managed_resource_source: 0,
type: 3,
url_collections: [],
url_custom_parameters: [],
},
ad_group: 'customers/9262111890/adGroups/56328868446',
ad_strength: 0,
policy_summary: { approval_status: 0, policy_topic_entries: [], review_status: 2 },
resource_name: 'customers/9262111890/adGroupAds/56328868446~284706472002',
status: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/9262111890/adGroups/56328868446',
campaign: 'customers/9262111890/campaigns/1485014801',
cpc_bid_micros: 1000000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
id: 56328868446,
labels: [],
name: 'My ad group',
resource_name: 'customers/9262111890/adGroups/56328868446',
status: 2,
target_cpa_micros: 0,
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/9262111890/campaigns/1485014801',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1548344372',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1485014801,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1485014801',
serving_status: 2,
start_date: '2018-07-24',
status: 2,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create an AdGroupAd
The customer.adGroupAds.create(ad_group_ad) method makes a new AdGroupAd in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupAd object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_ad = {
// Your AdGroupAd here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupAds.create(ad_group_ad)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupAds.create([ad_group_ad, other_ad_group_ad], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/adGroupAds/56328868446~284706472002'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupAd
The customer.adGroupAds.update(ad_group_ad) method changes the attributes of an existing adGroupAds in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupAd object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_ad = {
resource_name: 'customers/9262111890/adGroupAds/56328868446~284706472002', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupAds.update(ad_group_ad)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupAds.update([ad_group_ad, other_ad_group_ad], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/adGroupAds/56328868446~284706472002'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupAd
The customer.adGroupAds.delete(resource_name) sets the status field of an AdGroupAd to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupAd
Returns
Nothing
// Deleting the entity
await customer.adGroupAds.delete('customers/9262111890/adGroupAds/56328868446~284706472002')AdGroupAdLabel
The AdGroupAdLabel object
Fields
customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id}~{label_id}// Example AdGroupAdLabel
const ad_group_ad_label = {
ad_group_ad: 'customers/3827277046/adGroupAds/37706041345~206217423725',
label: 'customers/3827277046/labels/1285360183',
resource_name: 'customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183',
}Get an AdGroupAdLabel
The customer.adGroupAdLabels.get(resource_name) method returns the AdGroupAdLabel identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupAdLabel
Returns
Returns that AdGroupAdLabel as an object.
// Getting the entity
let result = await customer.adGroupAdLabels.get(
'customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183'
)// Example result
;({
ad_group_ad: 'customers/3827277046/adGroupAds/37706041345~206217423725',
label: 'customers/3827277046/labels/1285360183',
resource_name: 'customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183',
})List every instance of AdGroupAdLabel
The customer.adGroupAdLabels.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupAdLabel.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_ad_label property. Any other resources that can be selected with ad_group_ad_label will also be added as properities.
// Listing all the adGroupAdLabels in the account
let result = await customer.adGroupAdLabels.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupAdLabels.list({
constraints: [
{
key: 'ad_group_ad_label.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_ad_label.some_field.sub_field',
})// Example result
;[
{
ad_group_ad_label: {
ad_group_ad: 'customers/3827277046/adGroupAds/37706041345~206217423725',
label: 'customers/3827277046/labels/1285360183',
resource_name: 'customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183',
},
ad_group_ad: {
ad: {
added_by_google_ads: false,
device_preference: 0,
expanded_text_ad: {
description: 'State Of The Art AdWords PPC Tool. Designed For Agencies. Try It Free!',
headline_part1: 'Top Ad Words Tool',
headline_part2: 'Modern Way To Manage Accounts',
path1: 'ppc',
path2: 'tool',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['https://opteo.com'],
id: 206217423725,
resource_name: 'customers/3827277046/ads/206217423725',
system_managed_resource_source: 0,
type: 3,
url_collections: [],
url_custom_parameters: [],
},
ad_group: 'customers/3827277046/adGroups/37706041345',
ad_strength: 0,
policy_summary: {
approval_status: 2,
policy_topic_entries: [
{ topic: 'ONE_WEBSITE_PER_AD_GROUP', type: 2, evidences_list: [], constraints_list: [] },
],
review_status: 3,
},
resource_name: 'customers/3827277046/adGroupAds/37706041345~206217423725',
status: 4,
},
label: {
id: 1285360183,
name: 'My label',
resource_name: 'customers/3827277046/labels/1285360183',
status: 2,
text_label: { background_color: '#336666', description: '' },
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/37706041345',
campaign: 'customers/3827277046/campaigns/729684361',
cpc_bid_micros: 4770000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 37706041345,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/37706041345',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 4,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/729684361',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/1005523652',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 729684361,
labels: [],
manual_cpc: { enhanced_cpc_enabled: false },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/729684361',
serving_status: 2,
start_date: '2017-01-04',
status: 4,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AdGroupAdLabel
The customer.adGroupAdLabels.create(ad_group_ad_label) method makes a new AdGroupAdLabel in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupAdLabel object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_ad_label = {
// Your AdGroupAdLabel here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupAdLabels.create(ad_group_ad_label)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupAdLabels.create([ad_group_ad_label, other_ad_group_ad_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupAdLabel
The customer.adGroupAdLabels.update(ad_group_ad_label) method changes the attributes of an existing adGroupAdLabels in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupAdLabel object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_ad_label = {
resource_name: 'customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupAdLabels.update(ad_group_ad_label)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupAdLabels.update([ad_group_ad_label, other_ad_group_ad_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupAdLabel
The customer.adGroupAdLabels.delete(resource_name) sets the status field of an AdGroupAdLabel to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupAdLabel
Returns
Nothing
// Deleting the entity
await customer.adGroupAdLabels.delete('customers/3827277046/adGroupAdLabels/37706041345~206217423725~1285360183')AdGroupBidModifier
The AdGroupBidModifier object
Fields
- device objectImmutable. A device criterion.
- hotel_advance_booking_window objectImmutable. Criterion for number of days prior to the stay the booking is being made.
- hotel_check_in_day objectImmutable. Criterion for day of the week the booking is for.
- hotel_date_selection_type objectImmutable. Criterion for hotel date selection (default dates vs. user selected).
- hotel_length_of_stay objectImmutable. Criterion for length of hotel stay in nights.
- preferred_content objectImmutable. A preferred content criterion.
customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}// Example AdGroupBidModifier
const ad_group_bid_modifier = {
ad_group: 'customers/9262111890/adGroups/57176985017',
base_ad_group: 'customers/9262111890/adGroups/57176985017',
bid_modifier_source: 0,
criterion_id: 30000,
device: { type: 4 },
resource_name: 'customers/9262111890/adGroupBidModifiers/57176985017~30000',
}Get an AdGroupBidModifier
The customer.adGroupBidModifiers.get(resource_name) method returns the AdGroupBidModifier identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupBidModifier
Returns
Returns that AdGroupBidModifier as an object.
// Getting the entity
let result = await customer.adGroupBidModifiers.get('customers/9262111890/adGroupBidModifiers/57176985017~30000')// Example result
;({
ad_group: 'customers/9262111890/adGroups/57176985017',
base_ad_group: 'customers/9262111890/adGroups/57176985017',
bid_modifier_source: 0,
criterion_id: 30000,
device: { type: 4 },
resource_name: 'customers/9262111890/adGroupBidModifiers/57176985017~30000',
})List every instance of AdGroupBidModifier
The customer.adGroupBidModifiers.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupBidModifier.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_bid_modifier property. Any other resources that can be selected with ad_group_bid_modifier will also be added as properities.
// Listing all the adGroupBidModifiers in the account
let result = await customer.adGroupBidModifiers.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupBidModifiers.list({
constraints: [
{
key: 'ad_group_bid_modifier.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_bid_modifier.some_field.sub_field',
})// Example result
;[
{
ad_group_bid_modifier: {
ad_group: 'customers/9262111890/adGroups/57176985017',
base_ad_group: 'customers/9262111890/adGroups/57176985017',
bid_modifier_source: 0,
criterion_id: 30000,
device: { type: 4 },
resource_name: 'customers/9262111890/adGroupBidModifiers/57176985017~30000',
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/9262111890/adGroups/57176985017',
campaign: 'customers/9262111890/campaigns/1485014801',
cpc_bid_micros: 10000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
id: 57176985017,
labels: [],
name: 'My ad group',
resource_name: 'customers/9262111890/adGroups/57176985017',
status: 4,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: true },
{ targeting_dimension: 8, bid_only: true },
{ targeting_dimension: 9, bid_only: true },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/9262111890/campaigns/1485014801',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1548344372',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1485014801,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1485014801',
serving_status: 2,
start_date: '2018-07-24',
status: 2,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create an AdGroupBidModifier
The customer.adGroupBidModifiers.create(ad_group_bid_modifier) method makes a new AdGroupBidModifier in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupBidModifier object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_bid_modifier = {
// Your AdGroupBidModifier here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupBidModifiers.create(ad_group_bid_modifier)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupBidModifiers.create([ad_group_bid_modifier, other_ad_group_bid_modifier], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/adGroupBidModifiers/57176985017~30000'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupBidModifier
The customer.adGroupBidModifiers.update(ad_group_bid_modifier) method changes the attributes of an existing adGroupBidModifiers in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupBidModifier object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_bid_modifier = {
resource_name: 'customers/9262111890/adGroupBidModifiers/57176985017~30000', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupBidModifiers.update(ad_group_bid_modifier)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupBidModifiers.update([ad_group_bid_modifier, other_ad_group_bid_modifier], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/adGroupBidModifiers/57176985017~30000'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupBidModifier
The customer.adGroupBidModifiers.delete(resource_name) sets the status field of an AdGroupBidModifier to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupBidModifier
Returns
Nothing
// Deleting the entity
await customer.adGroupBidModifiers.delete('customers/9262111890/adGroupBidModifiers/57176985017~30000')AdGroupCriterion
The AdGroupCriterion object
Fields
- age_range objectImmutable. Age range.
- app_payment_model objectImmutable. App Payment Model.
- custom_affinity objectImmutable. Custom Affinity.
- custom_intent objectImmutable. Custom Intent.
- gender objectImmutable. Gender.
- income_range objectImmutable. Income range.
- keyword objectImmutable. Keyword.
- listing_group objectImmutable. Listing group.
- mobile_app_category objectImmutable. Mobile app category.
- mobile_application objectImmutable. Mobile application.
- parental_status objectImmutable. Parental status.
- placement objectImmutable. Placement.
- topic objectImmutable. Topic.
- user_interest objectImmutable. User Interest.
- user_list objectImmutable. User List.
- webpage objectImmutable. Webpage
- youtube_channel objectImmutable. YouTube Channel.
- youtube_video objectImmutable. YouTube Video.
false) or exclude (true) the criterion. This field is immutable. To switch a criterion from positive to negative, remove then re-add it.customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}tracking_url_template, final_urls, or mobile_final_urls.// Example AdGroupCriterion
const ad_group_criterion = {
ad_group: 'customers/9262111890/adGroups/60170225920',
approval_status: 4,
criterion_id: 521456008776,
disapproval_reasons: [],
effective_cpc_bid_micros: 1000000,
effective_cpc_bid_source: 6,
effective_cpm_bid_micros: 10000,
effective_cpm_bid_source: 6,
effective_cpv_bid_source: 0,
effective_percent_cpc_bid_source: 0,
final_mobile_urls: [],
final_urls: [],
keyword: { match_type: 4, text: 'test-keyword-478619' },
negative: false,
resource_name: 'customers/9262111890/adGroupCriteria/60170225920~521456008776',
status: 3,
system_serving_status: 3,
type: 2,
url_custom_parameters: [],
}Get an AdGroupCriterion
The customer.adGroupCriteria.get(resource_name) method returns the AdGroupCriterion identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupCriterion
Returns
Returns that AdGroupCriterion as an object.
// Getting the entity
let result = await customer.adGroupCriteria.get('customers/9262111890/adGroupCriteria/60170225920~521456008776')// Example result
;({
ad_group: 'customers/9262111890/adGroups/60170225920',
approval_status: 4,
criterion_id: 521456008776,
disapproval_reasons: [],
effective_cpc_bid_micros: 1000000,
effective_cpc_bid_source: 6,
effective_cpm_bid_micros: 10000,
effective_cpm_bid_source: 6,
effective_cpv_bid_source: 0,
effective_percent_cpc_bid_source: 0,
final_mobile_urls: [],
final_urls: [],
keyword: { match_type: 4, text: 'test-keyword-478619' },
negative: false,
resource_name: 'customers/9262111890/adGroupCriteria/60170225920~521456008776',
status: 3,
system_serving_status: 3,
type: 2,
url_custom_parameters: [],
})List every instance of AdGroupCriterion
The customer.adGroupCriteria.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupCriterion.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_criterion property. Any other resources that can be selected with ad_group_criterion will also be added as properities.
// Listing all the adGroupCriteria in the account
let result = await customer.adGroupCriteria.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupCriteria.list({
constraints: [
{
key: 'ad_group_criterion.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_criterion.some_field.sub_field',
})// Example result
;[
{
ad_group_criterion: {
ad_group: 'customers/9262111890/adGroups/60170225920',
approval_status: 4,
criterion_id: 521456008776,
disapproval_reasons: [],
effective_cpc_bid_micros: 1000000,
effective_cpc_bid_source: 6,
effective_cpm_bid_micros: 10000,
effective_cpm_bid_source: 6,
effective_cpv_bid_source: 0,
effective_percent_cpc_bid_source: 0,
final_mobile_urls: [],
final_urls: [],
keyword: { match_type: 4, text: 'test-keyword-478619' },
negative: false,
resource_name: 'customers/9262111890/adGroupCriteria/60170225920~521456008776',
status: 3,
system_serving_status: 3,
type: 2,
url_custom_parameters: [],
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/9262111890/adGroups/60170225920',
campaign: 'customers/9262111890/campaigns/1485014801',
cpc_bid_micros: 1000000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
id: 60170225920,
labels: [],
name: 'My ad group',
resource_name: 'customers/9262111890/adGroups/60170225920',
status: 2,
target_cpa_micros: 0,
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/9262111890/campaigns/1485014801',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1548344372',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1485014801,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1485014801',
serving_status: 2,
start_date: '2018-07-24',
status: 2,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create an AdGroupCriterion
The customer.adGroupCriteria.create(ad_group_criterion) method makes a new AdGroupCriterion in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupCriterion object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_criterion = {
// Your AdGroupCriterion here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupCriteria.create(ad_group_criterion)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupCriteria.create([ad_group_criterion, other_ad_group_criterion], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/adGroupCriteria/60170225920~521456008776'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupCriterion
The customer.adGroupCriteria.update(ad_group_criterion) method changes the attributes of an existing adGroupCriteria in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupCriterion object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_criterion = {
resource_name: 'customers/9262111890/adGroupCriteria/60170225920~521456008776', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupCriteria.update(ad_group_criterion)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupCriteria.update([ad_group_criterion, other_ad_group_criterion], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/adGroupCriteria/60170225920~521456008776'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupCriterion
The customer.adGroupCriteria.delete(resource_name) sets the status field of an AdGroupCriterion to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupCriterion
Returns
Nothing
// Deleting the entity
await customer.adGroupCriteria.delete('customers/9262111890/adGroupCriteria/60170225920~521456008776')AdGroupCriterionLabel
The AdGroupCriterionLabel object
Fields
customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}// Example AdGroupCriterionLabel
const ad_group_criterion_label = {
ad_group_criterion: 'customers/3827277046/adGroupCriteria/45808681353~331634074542',
label: 'customers/3827277046/labels/3866969030',
resource_name: 'customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030',
}Get an AdGroupCriterionLabel
The customer.adGroupCriterionLabels.get(resource_name) method returns the AdGroupCriterionLabel identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupCriterionLabel
Returns
Returns that AdGroupCriterionLabel as an object.
// Getting the entity
let result = await customer.adGroupCriterionLabels.get(
'customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030'
)// Example result
;({
ad_group_criterion: 'customers/3827277046/adGroupCriteria/45808681353~331634074542',
label: 'customers/3827277046/labels/3866969030',
resource_name: 'customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030',
})List every instance of AdGroupCriterionLabel
The customer.adGroupCriterionLabels.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupCriterionLabel.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_criterion_label property. Any other resources that can be selected with ad_group_criterion_label will also be added as properities.
// Listing all the adGroupCriterionLabels in the account
let result = await customer.adGroupCriterionLabels.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupCriterionLabels.list({
constraints: [
{
key: 'ad_group_criterion_label.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_criterion_label.some_field.sub_field',
})// Example result
;[
{
ad_group_criterion_label: {
ad_group_criterion: 'customers/3827277046/adGroupCriteria/45808681353~331634074542',
label: 'customers/3827277046/labels/3866969030',
resource_name: 'customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030',
},
ad_group_criterion: {
ad_group: 'customers/3827277046/adGroups/45808681353',
approval_status: 2,
cpc_bid_micros: 2880000,
criterion_id: 331634074542,
disapproval_reasons: [],
effective_cpc_bid_micros: 2880000,
effective_cpc_bid_source: 7,
effective_cpm_bid_micros: 10000,
effective_cpm_bid_source: 6,
effective_cpv_bid_source: 0,
effective_percent_cpc_bid_source: 0,
final_mobile_urls: [],
final_urls: [],
keyword: { match_type: 2, text: 'opteo adwords' },
negative: false,
resource_name: 'customers/3827277046/adGroupCriteria/45808681353~331634074542',
status: 3,
system_serving_status: 2,
type: 2,
url_custom_parameters: [],
},
label: {
id: 3866969030,
name: 'My label',
resource_name: 'customers/3827277046/labels/3866969030',
status: 2,
text_label: { background_color: '#1be779', description: '' },
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/45808681353',
campaign: 'customers/3827277046/campaigns/881817006',
cpc_bid_micros: 2720000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 45808681353,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/45808681353',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: true },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
],
},
type: 2,
url_custom_parameters: [{ key: 'yy', value: '1' }],
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/881817006',
bidding_strategy_type: 9,
campaign_budget: 'customers/3827277046/campaignBudgets/1159840470',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 881817006,
labels: ['customers/3827277046/labels/898377018'],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/881817006',
serving_status: 2,
start_date: '2017-07-12',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
tracking_url_template:
'https://ad.atdmt.com/s/go;adv=11202207688256;ec=11202207688723;c.a={campaignid};s.a=google;p.a={campaignid};as.a={adgroupid};qpb=1;?bidkw={keyword:defaultkeyword}&dvc={device}&h={lpurl}?utm_source=adwords&utm_medium=PPC&utm_campaign={campaignid}&utm_term={ifsearch:{keyword}}{ifcontent:{placement}}&utm_content={creative}&network={network}&adgroupid={adgroupid}&matchtype={matchtype}&adposition={adposition}&targetid={targetid}&target={target}&device={device}&devicemodel={devicemodel}',
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AdGroupCriterionLabel
The customer.adGroupCriterionLabels.create(ad_group_criterion_label) method makes a new AdGroupCriterionLabel in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupCriterionLabel object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_criterion_label = {
// Your AdGroupCriterionLabel here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupCriterionLabels.create(ad_group_criterion_label)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupCriterionLabels.create(
[ad_group_criterion_label, other_ad_group_criterion_label],
{
validate_only: true,
}
)// Example result
{
results : ['customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupCriterionLabel
The customer.adGroupCriterionLabels.update(ad_group_criterion_label) method changes the attributes of an existing adGroupCriterionLabels in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupCriterionLabel object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_criterion_label = {
resource_name: 'customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupCriterionLabels.update(ad_group_criterion_label)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupCriterionLabels.update(
[ad_group_criterion_label, other_ad_group_criterion_label],
{
validate_only: true,
}
)// Example result
{
results : ['customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupCriterionLabel
The customer.adGroupCriterionLabels.delete(resource_name) sets the status field of an AdGroupCriterionLabel to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupCriterionLabel
Returns
Nothing
// Deleting the entity
await customer.adGroupCriterionLabels.delete(
'customers/3827277046/adGroupCriterionLabels/45808681353~331634074542~3866969030'
)AdGroupCriterionSimulation
The AdGroupCriterionSimulation object
Fields
customers/{customer_id}/adGroupCriterionSimulations/{ad_group_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}// Example AdGroupCriterionSimulation
const ad_group_criterion_simulation = {
ad_group_id: 77057369032,
cpc_bid_point_list: {
points: [
{
cpc_bid_micros: 2750000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 2,
cost_micros: 1680000,
impressions: 116,
top_slot_impressions: 94,
},
{
cpc_bid_micros: 3000000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 2,
cost_micros: 5740000,
impressions: 144,
top_slot_impressions: 113,
},
{
cpc_bid_micros: 3110000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 10800000,
impressions: 168,
top_slot_impressions: 131,
},
{
cpc_bid_micros: 4070000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 15350000,
impressions: 192,
top_slot_impressions: 154,
},
{
cpc_bid_micros: 5030000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 4,
cost_micros: 22940000,
impressions: 212,
top_slot_impressions: 182,
},
{
cpc_bid_micros: 6310000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 38520000,
impressions: 232,
top_slot_impressions: 208,
},
{
cpc_bid_micros: 9060000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 50360000,
impressions: 237,
top_slot_impressions: 220,
},
],
},
criterion_id: 391658604416,
end_date: '2020-07-17',
modification_method: 2,
resource_name:
'customers/3827277046/adGroupCriterionSimulations/77057369032~391658604416~CPC_BID~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 2,
}Get an AdGroupCriterionSimulation
The customer.adGroupCriterionSimulations.get(resource_name) method returns the AdGroupCriterionSimulation identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupCriterionSimulation
Returns
Returns that AdGroupCriterionSimulation as an object.
// Getting the entity
let result = await customer.adGroupCriterionSimulations.get(
'customers/3827277046/adGroupCriterionSimulations/77057369032~391658604416~CPC_BID~UNIFORM~20200711~20200717'
)// Example result
;({
ad_group_id: 77057369032,
cpc_bid_point_list: {
points: [
{
cpc_bid_micros: 2750000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 2,
cost_micros: 1680000,
impressions: 116,
top_slot_impressions: 94,
},
{
cpc_bid_micros: 3000000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 2,
cost_micros: 5740000,
impressions: 144,
top_slot_impressions: 113,
},
{
cpc_bid_micros: 3110000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 10800000,
impressions: 168,
top_slot_impressions: 131,
},
{
cpc_bid_micros: 4070000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 15350000,
impressions: 192,
top_slot_impressions: 154,
},
{
cpc_bid_micros: 5030000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 4,
cost_micros: 22940000,
impressions: 212,
top_slot_impressions: 182,
},
{
cpc_bid_micros: 6310000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 38520000,
impressions: 232,
top_slot_impressions: 208,
},
{
cpc_bid_micros: 9060000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 50360000,
impressions: 237,
top_slot_impressions: 220,
},
],
},
criterion_id: 391658604416,
end_date: '2020-07-17',
modification_method: 2,
resource_name:
'customers/3827277046/adGroupCriterionSimulations/77057369032~391658604416~CPC_BID~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 2,
})List every instance of AdGroupCriterionSimulation
The customer.adGroupCriterionSimulations.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupCriterionSimulation.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_criterion_simulation property. Any other resources that can be selected with ad_group_criterion_simulation will also be added as properities.
// Listing all the adGroupCriterionSimulations in the account
let result = await customer.adGroupCriterionSimulations.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupCriterionSimulations.list({
constraints: [
{
key: 'ad_group_criterion_simulation.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_criterion_simulation.some_field.sub_field',
})// Example result
;[
{
ad_group_criterion_simulation: {
ad_group_id: 77057369032,
cpc_bid_point_list: {
points: [
{
cpc_bid_micros: 2750000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 2,
cost_micros: 1680000,
impressions: 116,
top_slot_impressions: 94,
},
{
cpc_bid_micros: 3000000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 2,
cost_micros: 5740000,
impressions: 144,
top_slot_impressions: 113,
},
{
cpc_bid_micros: 3110000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 10800000,
impressions: 168,
top_slot_impressions: 131,
},
{
cpc_bid_micros: 4070000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 15350000,
impressions: 192,
top_slot_impressions: 154,
},
{
cpc_bid_micros: 5030000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 4,
cost_micros: 22940000,
impressions: 212,
top_slot_impressions: 182,
},
{
cpc_bid_micros: 6310000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 38520000,
impressions: 232,
top_slot_impressions: 208,
},
{
cpc_bid_micros: 9060000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 50360000,
impressions: 237,
top_slot_impressions: 220,
},
],
},
criterion_id: 391658604416,
end_date: '2020-07-17',
modification_method: 2,
resource_name:
'customers/3827277046/adGroupCriterionSimulations/77057369032~391658604416~CPC_BID~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 2,
},
ad_group_criterion: {
ad_group: 'customers/3827277046/adGroups/77057369032',
approval_status: 2,
criterion_id: 391658604416,
disapproval_reasons: [],
effective_cpc_bid_micros: 6310000,
effective_cpc_bid_source: 6,
effective_cpm_bid_micros: 10000000,
effective_cpm_bid_source: 6,
effective_cpv_bid_source: 0,
effective_percent_cpc_bid_source: 0,
final_mobile_urls: [],
final_urls: [],
keyword: { match_type: 4, text: '+google +ads +optimization' },
negative: false,
position_estimates: {
estimated_add_clicks_at_first_position_cpc: -3,
estimated_add_cost_at_first_position_cpc: -34860000,
first_page_cpc_micros: 1470000,
first_position_cpc_micros: 1470000,
top_of_page_cpc_micros: 1470000,
},
quality_info: {
creative_quality_score: 4,
post_click_quality_score: 3,
quality_score: 5,
search_predicted_ctr: 2,
},
resource_name: 'customers/3827277046/adGroupCriteria/77057369032~391658604416',
status: 2,
system_serving_status: 2,
type: 2,
url_custom_parameters: [],
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/77057369032',
campaign: 'customers/3827277046/campaigns/2081620945',
cpc_bid_micros: 6310000,
cpm_bid_micros: 10000000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 12000000,
effective_target_cpa_source: 6,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 77057369032,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/77057369032',
status: 2,
target_cpa_micros: 12000000,
target_cpm_micros: 10000,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: true },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: true },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: true },
{ targeting_dimension: 9, bid_only: true },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/2081620945',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/6449346159',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 5, positive_geo_target_type: 7 },
id: 2081620945,
labels: [
'customers/3827277046/labels/3889728216',
'customers/3827277046/labels/3889728468',
'customers/3827277046/labels/3889728480',
],
manual_cpc: { enhanced_cpc_enabled: true },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
optimization_score: 0.7376711477461586,
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/2081620945',
serving_status: 2,
start_date: '2019-07-30',
status: 2,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: true }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]AdGroupExtensionSetting
The AdGroupExtensionSetting object
Fields
customers/{customer_id}/adGroups/{ad_group_id}customers/{customer_id}/extensionFeedItems/{feed_item_id}customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}// Example AdGroupExtensionSetting
const ad_group_extension_setting = {
ad_group: 'customers/3827277046/adGroups/69639056828',
device: 0,
extension_feed_items: [
'customers/3827277046/extensionFeedItems/48199744867',
'customers/3827277046/extensionFeedItems/48199839565',
'customers/3827277046/extensionFeedItems/48200356726',
'customers/3827277046/extensionFeedItems/48200575108',
'customers/3827277046/extensionFeedItems/48200618792',
],
extension_type: 10,
resource_name: 'customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK',
}Get an AdGroupExtensionSetting
The customer.adGroupExtensionSettings.get(resource_name) method returns the AdGroupExtensionSetting identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupExtensionSetting
Returns
Returns that AdGroupExtensionSetting as an object.
// Getting the entity
let result = await customer.adGroupExtensionSettings.get(
'customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK'
)// Example result
;({
ad_group: 'customers/3827277046/adGroups/69639056828',
device: 0,
extension_feed_items: [
'customers/3827277046/extensionFeedItems/48199744867',
'customers/3827277046/extensionFeedItems/48199839565',
'customers/3827277046/extensionFeedItems/48200356726',
'customers/3827277046/extensionFeedItems/48200575108',
'customers/3827277046/extensionFeedItems/48200618792',
],
extension_type: 10,
resource_name: 'customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK',
})List every instance of AdGroupExtensionSetting
The customer.adGroupExtensionSettings.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupExtensionSetting.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_extension_setting property. Any other resources that can be selected with ad_group_extension_setting will also be added as properities.
// Listing all the adGroupExtensionSettings in the account
let result = await customer.adGroupExtensionSettings.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupExtensionSettings.list({
constraints: [
{
key: 'ad_group_extension_setting.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_extension_setting.some_field.sub_field',
})// Example result
;[
{
ad_group_extension_setting: {
ad_group: 'customers/3827277046/adGroups/69639056828',
device: 0,
extension_feed_items: [
'customers/3827277046/extensionFeedItems/48199744867',
'customers/3827277046/extensionFeedItems/48199839565',
'customers/3827277046/extensionFeedItems/48200356726',
'customers/3827277046/extensionFeedItems/48200575108',
'customers/3827277046/extensionFeedItems/48200618792',
],
extension_type: 10,
resource_name: 'customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK',
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/69639056828',
campaign: 'customers/3827277046/campaigns/954460701',
cpc_bid_micros: 4500000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 69639056828,
labels: ['customers/3827277046/labels/3345231412'],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/69639056828',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/954460701',
bidding_strategy_type: 9,
campaign_budget: 'customers/3827277046/campaignBudgets/1234926420',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 954460701,
labels: ['customers/3827277046/labels/3889728471'],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/954460701',
serving_status: 2,
start_date: '2017-10-13',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AdGroupExtensionSetting
The customer.adGroupExtensionSettings.create(ad_group_extension_setting) method makes a new AdGroupExtensionSetting in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupExtensionSetting object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_extension_setting = {
// Your AdGroupExtensionSetting here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupExtensionSettings.create(ad_group_extension_setting)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupExtensionSettings.create(
[ad_group_extension_setting, other_ad_group_extension_setting],
{
validate_only: true,
}
)// Example result
{
results : ['customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupExtensionSetting
The customer.adGroupExtensionSettings.update(ad_group_extension_setting) method changes the attributes of an existing adGroupExtensionSettings in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupExtensionSetting object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_extension_setting = {
resource_name: 'customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupExtensionSettings.update(ad_group_extension_setting)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupExtensionSettings.update(
[ad_group_extension_setting, other_ad_group_extension_setting],
{
validate_only: true,
}
)// Example result
{
results : ['customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupExtensionSetting
The customer.adGroupExtensionSettings.delete(resource_name) sets the status field of an AdGroupExtensionSetting to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupExtensionSetting
Returns
Nothing
// Deleting the entity
await customer.adGroupExtensionSettings.delete('customers/3827277046/adGroupExtensionSettings/69639056828~SITELINK')AdGroupFeed
The AdGroupFeed object
Fields
// Example AdGroupFeed
const ad_group_feed = {
ad_group: 'customers/3827277046/adGroups/69639056828',
feed: 'customers/3827277046/feeds/43009393',
matching_function: {
function_string: 'IN(FEED_ITEM_ID,{48200575108,48199744867,48200356726,48199839565,48200618792})',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 2,
right_operands: [
{ constant_operand: { long_value: 48200575108 } },
{ constant_operand: { long_value: 48199744867 } },
{ constant_operand: { long_value: 48200356726 } },
{ constant_operand: { long_value: 48199839565 } },
{ constant_operand: { long_value: 48200618792 } },
],
},
placeholder_types: [],
resource_name: 'customers/3827277046/adGroupFeeds/69639056828~43009393',
status: 2,
}Get an AdGroupFeed
The customer.adGroupFeeds.get(resource_name) method returns the AdGroupFeed identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupFeed
Returns
Returns that AdGroupFeed as an object.
// Getting the entity
let result = await customer.adGroupFeeds.get('customers/3827277046/adGroupFeeds/69639056828~43009393')// Example result
;({
ad_group: 'customers/3827277046/adGroups/69639056828',
feed: 'customers/3827277046/feeds/43009393',
matching_function: {
function_string: 'IN(FEED_ITEM_ID,{48200575108,48199744867,48200356726,48199839565,48200618792})',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 2,
right_operands: [
{ constant_operand: { long_value: 48200575108 } },
{ constant_operand: { long_value: 48199744867 } },
{ constant_operand: { long_value: 48200356726 } },
{ constant_operand: { long_value: 48199839565 } },
{ constant_operand: { long_value: 48200618792 } },
],
},
placeholder_types: [],
resource_name: 'customers/3827277046/adGroupFeeds/69639056828~43009393',
status: 2,
})List every instance of AdGroupFeed
The customer.adGroupFeeds.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupFeed.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_feed property. Any other resources that can be selected with ad_group_feed will also be added as properities.
// Listing all the adGroupFeeds in the account
let result = await customer.adGroupFeeds.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupFeeds.list({
constraints: [
{
key: 'ad_group_feed.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_feed.some_field.sub_field',
})// Example result
;[
{
ad_group_feed: {
ad_group: 'customers/3827277046/adGroups/69639056828',
feed: 'customers/3827277046/feeds/43009393',
matching_function: {
function_string: 'IN(FEED_ITEM_ID,{48200575108,48199744867,48200356726,48199839565,48200618792})',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 2,
right_operands: [
{ constant_operand: { long_value: 48200575108 } },
{ constant_operand: { long_value: 48199744867 } },
{ constant_operand: { long_value: 48200356726 } },
{ constant_operand: { long_value: 48199839565 } },
{ constant_operand: { long_value: 48200618792 } },
],
},
placeholder_types: [],
resource_name: 'customers/3827277046/adGroupFeeds/69639056828~43009393',
status: 2,
},
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 43009393,
name: 'My feed',
origin: 3,
resource_name: 'customers/3827277046/feeds/43009393',
status: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/69639056828',
campaign: 'customers/3827277046/campaigns/954460701',
cpc_bid_micros: 4500000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 69639056828,
labels: ['customers/3827277046/labels/3345231412'],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/69639056828',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/954460701',
bidding_strategy_type: 9,
campaign_budget: 'customers/3827277046/campaignBudgets/1234926420',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 954460701,
labels: ['customers/3827277046/labels/3889728471'],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/954460701',
serving_status: 2,
start_date: '2017-10-13',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AdGroupFeed
The customer.adGroupFeeds.create(ad_group_feed) method makes a new AdGroupFeed in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupFeed object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_feed = {
// Your AdGroupFeed here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupFeeds.create(ad_group_feed)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupFeeds.create([ad_group_feed, other_ad_group_feed], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroupFeeds/69639056828~43009393'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupFeed
The customer.adGroupFeeds.update(ad_group_feed) method changes the attributes of an existing adGroupFeeds in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupFeed object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_feed = {
resource_name: 'customers/3827277046/adGroupFeeds/69639056828~43009393', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupFeeds.update(ad_group_feed)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupFeeds.update([ad_group_feed, other_ad_group_feed], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroupFeeds/69639056828~43009393'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupFeed
The customer.adGroupFeeds.delete(resource_name) sets the status field of an AdGroupFeed to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupFeed
Returns
Nothing
// Deleting the entity
await customer.adGroupFeeds.delete('customers/3827277046/adGroupFeeds/69639056828~43009393')AdGroupLabel
The AdGroupLabel object
Fields
customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}// Example AdGroupLabel
const ad_group_label = {
ad_group: 'customers/3827277046/adGroups/69639056828',
label: 'customers/3827277046/labels/3345231412',
resource_name: 'customers/3827277046/adGroupLabels/69639056828~3345231412',
}Get an AdGroupLabel
The customer.adGroupLabels.get(resource_name) method returns the AdGroupLabel identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupLabel
Returns
Returns that AdGroupLabel as an object.
// Getting the entity
let result = await customer.adGroupLabels.get('customers/3827277046/adGroupLabels/69639056828~3345231412')// Example result
;({
ad_group: 'customers/3827277046/adGroups/69639056828',
label: 'customers/3827277046/labels/3345231412',
resource_name: 'customers/3827277046/adGroupLabels/69639056828~3345231412',
})List every instance of AdGroupLabel
The customer.adGroupLabels.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupLabel.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_label property. Any other resources that can be selected with ad_group_label will also be added as properities.
// Listing all the adGroupLabels in the account
let result = await customer.adGroupLabels.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupLabels.list({
constraints: [
{
key: 'ad_group_label.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_label.some_field.sub_field',
})// Example result
;[
{
ad_group_label: {
ad_group: 'customers/3827277046/adGroups/69639056828',
label: 'customers/3827277046/labels/3345231412',
resource_name: 'customers/3827277046/adGroupLabels/69639056828~3345231412',
},
label: {
id: 3345231412,
name: 'My label',
resource_name: 'customers/3827277046/labels/3345231412',
status: 2,
text_label: {
background_color: '#e993eb',
description: 'Adgroups where Chloe will write new ads that kick butt.',
},
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/69639056828',
campaign: 'customers/3827277046/campaigns/954460701',
cpc_bid_micros: 4500000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 69639056828,
labels: ['customers/3827277046/labels/3345231412'],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/69639056828',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/954460701',
bidding_strategy_type: 9,
campaign_budget: 'customers/3827277046/campaignBudgets/1234926420',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 954460701,
labels: ['customers/3827277046/labels/3889728471'],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/954460701',
serving_status: 2,
start_date: '2017-10-13',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an AdGroupLabel
The customer.adGroupLabels.create(ad_group_label) method makes a new AdGroupLabel in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupLabel object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const ad_group_label = {
// Your AdGroupLabel here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.adGroupLabels.create(ad_group_label)
// Passing in an array of entities to create, validating only
const result = await customer.adGroupLabels.create([ad_group_label, other_ad_group_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroupLabels/69639056828~3345231412'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an AdGroupLabel
The customer.adGroupLabels.update(ad_group_label) method changes the attributes of an existing adGroupLabels in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The AdGroupLabel object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const ad_group_label = {
resource_name: 'customers/3827277046/adGroupLabels/69639056828~3345231412', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.adGroupLabels.update(ad_group_label)
// Passing in an array of entities to update, validating only
const result = await customer.adGroupLabels.update([ad_group_label, other_ad_group_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/adGroupLabels/69639056828~3345231412'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an AdGroupLabel
The customer.adGroupLabels.delete(resource_name) sets the status field of an AdGroupLabel to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that AdGroupLabel
Returns
Nothing
// Deleting the entity
await customer.adGroupLabels.delete('customers/3827277046/adGroupLabels/69639056828~3345231412')AdGroupSimulation
The AdGroupSimulation object
Fields
- cpc_bid_point_list objectOutput only. Simulation points if the simulation type is CPC_BID.
- cpv_bid_point_list objectOutput only. Simulation points if the simulation type is CPV_BID.
- target_cpa_point_list objectOutput only. Simulation points if the simulation type is TARGET_CPA.
- target_roas_point_list objectOutput only. Simulation points if the simulation type is TARGET_ROAS.
customers/{customer_id}/adGroupSimulations/{ad_group_id}~{type}~{modification_method}~{start_date}~{end_date}// Example AdGroupSimulation
const ad_group_simulation = {
ad_group_id: 77057363752,
cpc_bid_point_list: {
points: [
{
cpc_bid_micros: 1820000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 7,
cost_micros: 10540000,
impressions: 151,
top_slot_impressions: 103,
},
{
cpc_bid_micros: 1910000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 16740000,
impressions: 187,
top_slot_impressions: 138,
},
{
cpc_bid_micros: 3830000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 13,
cost_micros: 32520000,
impressions: 218,
top_slot_impressions: 170,
},
{
cpc_bid_micros: 4610000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 16,
cost_micros: 53450000,
impressions: 250,
top_slot_impressions: 200,
},
{
cpc_bid_micros: 5500000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 17,
cost_micros: 66370000,
impressions: 280,
top_slot_impressions: 233,
},
{
cpc_bid_micros: 9600000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 19,
cost_micros: 127600000,
impressions: 299,
top_slot_impressions: 276,
},
{
cpc_bid_micros: 11750000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 20,
cost_micros: 153720000,
impressions: 304,
top_slot_impressions: 281,
},
],
},
end_date: '2020-07-17',
modification_method: 2,
resource_name: 'customers/3827277046/adGroupSimulations/77057363752~CPC_BID~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 2,
}Get an AdGroupSimulation
The customer.adGroupSimulations.get(resource_name) method returns the AdGroupSimulation identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that AdGroupSimulation
Returns
Returns that AdGroupSimulation as an object.
// Getting the entity
let result = await customer.adGroupSimulations.get(
'customers/3827277046/adGroupSimulations/77057363752~CPC_BID~UNIFORM~20200711~20200717'
)// Example result
;({
ad_group_id: 77057363752,
cpc_bid_point_list: {
points: [
{
cpc_bid_micros: 1820000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 7,
cost_micros: 10540000,
impressions: 151,
top_slot_impressions: 103,
},
{
cpc_bid_micros: 1910000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 16740000,
impressions: 187,
top_slot_impressions: 138,
},
{
cpc_bid_micros: 3830000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 13,
cost_micros: 32520000,
impressions: 218,
top_slot_impressions: 170,
},
{
cpc_bid_micros: 4610000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 16,
cost_micros: 53450000,
impressions: 250,
top_slot_impressions: 200,
},
{
cpc_bid_micros: 5500000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 17,
cost_micros: 66370000,
impressions: 280,
top_slot_impressions: 233,
},
{
cpc_bid_micros: 9600000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 19,
cost_micros: 127600000,
impressions: 299,
top_slot_impressions: 276,
},
{
cpc_bid_micros: 11750000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 20,
cost_micros: 153720000,
impressions: 304,
top_slot_impressions: 281,
},
],
},
end_date: '2020-07-17',
modification_method: 2,
resource_name: 'customers/3827277046/adGroupSimulations/77057363752~CPC_BID~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 2,
})List every instance of AdGroupSimulation
The customer.adGroupSimulations.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of AdGroupSimulation.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a ad_group_simulation property. Any other resources that can be selected with ad_group_simulation will also be added as properities.
// Listing all the adGroupSimulations in the account
let result = await customer.adGroupSimulations.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.adGroupSimulations.list({
constraints: [
{
key: 'ad_group_simulation.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'ad_group_simulation.some_field.sub_field',
})// Example result
;[
{
ad_group_simulation: {
ad_group_id: 77057363752,
cpc_bid_point_list: {
points: [
{
cpc_bid_micros: 1820000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 7,
cost_micros: 10540000,
impressions: 151,
top_slot_impressions: 103,
},
{
cpc_bid_micros: 1910000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 16740000,
impressions: 187,
top_slot_impressions: 138,
},
{
cpc_bid_micros: 3830000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 13,
cost_micros: 32520000,
impressions: 218,
top_slot_impressions: 170,
},
{
cpc_bid_micros: 4610000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 16,
cost_micros: 53450000,
impressions: 250,
top_slot_impressions: 200,
},
{
cpc_bid_micros: 5500000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 17,
cost_micros: 66370000,
impressions: 280,
top_slot_impressions: 233,
},
{
cpc_bid_micros: 9600000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 19,
cost_micros: 127600000,
impressions: 299,
top_slot_impressions: 276,
},
{
cpc_bid_micros: 11750000,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 20,
cost_micros: 153720000,
impressions: 304,
top_slot_impressions: 281,
},
],
},
end_date: '2020-07-17',
modification_method: 2,
resource_name: 'customers/3827277046/adGroupSimulations/77057363752~CPC_BID~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/77057363752',
campaign: 'customers/3827277046/campaigns/2081620948',
cpc_bid_micros: 9600000,
cpm_bid_micros: 10000000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 12000000,
effective_target_cpa_source: 6,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 77057363752,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/77057363752',
status: 2,
target_cpa_micros: 12000000,
target_cpm_micros: 10000000,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: true },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: true },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: true },
{ targeting_dimension: 9, bid_only: true },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/2081620948',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/6449346162',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 5, positive_geo_target_type: 7 },
id: 2081620948,
labels: [
'customers/3827277046/labels/3889728216',
'customers/3827277046/labels/3889728468',
'customers/3827277046/labels/3889728480',
],
manual_cpc: { enhanced_cpc_enabled: true },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
optimization_score: 0.8309262174345264,
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/2081620948',
serving_status: 2,
start_date: '2019-07-30',
status: 2,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: true }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Asset
The Asset object
Fields
- book_on_google_asset objectA book on google asset.
- image_asset objectOutput only. An image asset.
- media_bundle_asset objectImmutable. A media bundle asset.
- text_asset objectOutput only. A text asset.
- youtube_video_asset objectImmutable. A YouTube video asset.
customers/{customer_id}/assets/{asset_id}// Example Asset
const asset = {
id: 225386305,
image_asset: {
file_size: 472254,
full_size: {
height_pixels: 628,
url: 'https://tpc.googlesyndication.com/simgad/11290736009894828590',
width_pixels: 1200,
},
mime_type: 4,
},
name: '',
resource_name: 'customers/3827277046/assets/225386305',
type: 4,
}Get an Asset
The customer.assets.get(resource_name) method returns the Asset identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Asset
Returns
Returns that Asset as an object.
// Getting the entity
let result = await customer.assets.get('customers/3827277046/assets/225386305')// Example result
;({
id: 225386305,
image_asset: {
file_size: 472254,
full_size: {
height_pixels: 628,
url: 'https://tpc.googlesyndication.com/simgad/11290736009894828590',
width_pixels: 1200,
},
mime_type: 4,
},
name: '',
resource_name: 'customers/3827277046/assets/225386305',
type: 4,
})List every instance of Asset
The customer.assets.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Asset.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a asset property. Any other resources that can be selected with asset will also be added as properities.
// Listing all the assets in the account
let result = await customer.assets.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.assets.list({
constraints: [
{
key: 'asset.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'asset.some_field.sub_field',
})// Example result
;[
{
asset: {
id: 225386305,
image_asset: {
file_size: 472254,
full_size: {
height_pixels: 628,
url: 'https://tpc.googlesyndication.com/simgad/11290736009894828590',
width_pixels: 1200,
},
mime_type: 4,
},
name: '',
resource_name: 'customers/3827277046/assets/225386305',
type: 4,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create an Asset
The customer.assets.create(asset) method makes a new Asset in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Asset object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const asset = {
// Your Asset here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.assets.create(asset)
// Passing in an array of entities to create, validating only
const result = await customer.assets.create([asset, other_asset], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/assets/225386305'],
partial_failure_error : null,
request: { /* your request object */ }
}Update an Asset
The customer.assets.update(asset) method changes the attributes of an existing assets in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Asset object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const asset = {
resource_name: 'customers/3827277046/assets/225386305', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.assets.update(asset)
// Passing in an array of entities to update, validating only
const result = await customer.assets.update([asset, other_asset], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/assets/225386305'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete an Asset
The customer.assets.delete(resource_name) sets the status field of an Asset to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that Asset
Returns
Nothing
// Deleting the entity
await customer.assets.delete('customers/3827277046/assets/225386305')BiddingStrategy
The BiddingStrategy object
Fields
- enhanced_cpc objectA bidding strategy that raises bids for clicks that seem more likely to lead to a conversion and lowers them for clicks where they seem less likely.
- target_cpa objectA bidding strategy that sets bids to help get as many conversions as possible at the target cost-per-acquisition (CPA) you set.
- target_impression_share objectA bidding strategy that automatically optimizes towards a desired percentage of impressions.
- target_roas objectA bidding strategy that helps you maximize revenue while averaging a specific target Return On Ad Spend (ROAS).
- target_spend objectA bid strategy that sets your bids to help get as many clicks as possible within your budget.
customers/{customer_id}/biddingStrategies/{bidding_strategy_id}// Example BiddingStrategy
const bidding_strategy = {
campaign_count: 7,
id: 2039955526,
name: 'My bidding strategy',
non_removed_campaign_count: 7,
resource_name: 'customers/3827277046/biddingStrategies/2039955526',
status: 2,
target_impression_share: { cpc_bid_ceiling_micros: 10000000, location: 4, location_fraction_micros: 900000 },
type: 15,
}Get a BiddingStrategy
The customer.biddingStrategies.get(resource_name) method returns the BiddingStrategy identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that BiddingStrategy
Returns
Returns that BiddingStrategy as an object.
// Getting the entity
let result = await customer.biddingStrategies.get('customers/3827277046/biddingStrategies/2039955526')// Example result
;({
campaign_count: 7,
id: 2039955526,
name: 'My bidding strategy',
non_removed_campaign_count: 7,
resource_name: 'customers/3827277046/biddingStrategies/2039955526',
status: 2,
target_impression_share: { cpc_bid_ceiling_micros: 10000000, location: 4, location_fraction_micros: 900000 },
type: 15,
})List every instance of BiddingStrategy
The customer.biddingStrategies.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of BiddingStrategy.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a bidding_strategy property. Any other resources that can be selected with bidding_strategy will also be added as properities.
// Listing all the biddingStrategies in the account
let result = await customer.biddingStrategies.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.biddingStrategies.list({
constraints: [
{
key: 'bidding_strategy.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'bidding_strategy.some_field.sub_field',
})// Example result
;[
{
bidding_strategy: {
campaign_count: 7,
id: 2039955526,
name: 'My bidding strategy',
non_removed_campaign_count: 7,
resource_name: 'customers/3827277046/biddingStrategies/2039955526',
status: 2,
target_impression_share: { cpc_bid_ceiling_micros: 10000000, location: 4, location_fraction_micros: 900000 },
type: 15,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a BiddingStrategy
The customer.biddingStrategies.create(bidding_strategy) method makes a new BiddingStrategy in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The BiddingStrategy object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const bidding_strategy = {
// Your BiddingStrategy here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.biddingStrategies.create(bidding_strategy)
// Passing in an array of entities to create, validating only
const result = await customer.biddingStrategies.create([bidding_strategy, other_bidding_strategy], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/biddingStrategies/2039955526'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a BiddingStrategy
The customer.biddingStrategies.update(bidding_strategy) method changes the attributes of an existing biddingStrategies in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The BiddingStrategy object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const bidding_strategy = {
resource_name: 'customers/3827277046/biddingStrategies/2039955526', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.biddingStrategies.update(bidding_strategy)
// Passing in an array of entities to update, validating only
const result = await customer.biddingStrategies.update([bidding_strategy, other_bidding_strategy], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/biddingStrategies/2039955526'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a BiddingStrategy
The customer.biddingStrategies.delete(resource_name) sets the status field of a BiddingStrategy to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that BiddingStrategy
Returns
Nothing
// Deleting the entity
await customer.biddingStrategies.delete('customers/3827277046/biddingStrategies/2039955526')BillingSetup
The BillingSetup object
Fields
- end_date_time string
- end_time_type enum
- start_date_time string
- start_time_type enum
customers/{customer_id}/paymentsAccounts/{payments_account_id} When setting up billing, this is used to signup with an existing payments account (and then payments_account_info should not be set). When getting a billing setup, this and payments_account_info will be populated.customers/{customer_id}/billingSetups/{billing_setup_id}// Example BillingSetup
const billing_setup = {
end_time_type: 3,
id: 465508048,
resource_name: 'customers/9262111890/billingSetups/465508048',
start_date_time: '2018-07-23 15:51:33',
status: 2,
}Get a BillingSetup
The customer.billingSetups.get(resource_name) method returns the BillingSetup identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that BillingSetup
Returns
Returns that BillingSetup as an object.
// Getting the entity
let result = await customer.billingSetups.get('customers/9262111890/billingSetups/465508048')// Example result
;({
end_time_type: 3,
id: 465508048,
resource_name: 'customers/9262111890/billingSetups/465508048',
start_date_time: '2018-07-23 15:51:33',
status: 2,
})List every instance of BillingSetup
The customer.billingSetups.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of BillingSetup.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a billing_setup property. Any other resources that can be selected with billing_setup will also be added as properities.
// Listing all the billingSetups in the account
let result = await customer.billingSetups.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.billingSetups.list({
constraints: [
{
key: 'billing_setup.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'billing_setup.some_field.sub_field',
})// Example result
;[
{
billing_setup: {
end_time_type: 3,
id: 465508048,
resource_name: 'customers/9262111890/billingSetups/465508048',
start_date_time: '2018-07-23 15:51:33',
status: 2,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a BillingSetup
The customer.billingSetups.create(billing_setup) method makes a new BillingSetup in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The BillingSetup object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const billing_setup = {
// Your BillingSetup here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.billingSetups.create(billing_setup)
// Passing in an array of entities to create, validating only
const result = await customer.billingSetups.create([billing_setup, other_billing_setup], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/billingSetups/465508048'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a BillingSetup
The customer.billingSetups.update(billing_setup) method changes the attributes of an existing billingSetups in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The BillingSetup object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const billing_setup = {
resource_name: 'customers/9262111890/billingSetups/465508048', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.billingSetups.update(billing_setup)
// Passing in an array of entities to update, validating only
const result = await customer.billingSetups.update([billing_setup, other_billing_setup], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/billingSetups/465508048'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a BillingSetup
The customer.billingSetups.delete(resource_name) sets the status field of a BillingSetup to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that BillingSetup
Returns
Nothing
// Deleting the entity
await customer.billingSetups.delete('customers/9262111890/billingSetups/465508048')Campaign
The Campaign object
Fields
- bidding_strategy string
- commission objectCommission is an automatic bidding strategy in which the advertiser pays a certain portion of the conversion value.
- manual_cpc objectStandard Manual CPC bidding strategy. Manual click-based bidding where user pays per click.
- manual_cpm objectStandard Manual CPM bidding strategy. Manual impression-based bidding where user pays per thousand impressions.
- manual_cpv objectOutput only. A bidding strategy that pays a configurable amount per video view.
- maximize_conversion_value objectStandard Maximize Conversion Value bidding strategy that automatically sets bids to maximize revenue while spending your budget.
- maximize_conversions objectStandard Maximize Conversions bidding strategy that automatically maximizes number of conversions given a daily budget.
- percent_cpc objectStandard Percent Cpc bidding strategy where bids are a fraction of the advertised price for some good or service.
- target_cpa objectStandard Target CPA bidding strategy that automatically sets bids to help get as many conversions as possible at the target cost-per-acquisition (CPA) you set.
- target_cpm objectA bidding strategy that automatically optimizes cost per thousand impressions.
- target_impression_share objectTarget Impression Share bidding strategy. An automated bidding strategy that sets bids to achieve a desired percentage of impressions.
- target_roas objectStandard Target ROAS bidding strategy that automatically maximizes revenue while averaging a specific target return on ad spend (ROAS).
- target_spend objectStandard Target Spend bidding strategy that automatically sets your bids to help get as many clicks as possible within your budget.
advertising_channel_type. Must be a valid sub-type of the parent channel type. Can be set only when creating campaigns. After campaign is created, the field can not be changed.network_settings. This field is required and should not be empty when creating new campaigns. Can be set only when creating campaigns. After the campaign is created, the field can not be changed.resource_name. This field is read-only.bidding_strategy field to create a portfolio bidding strategy. This field is read-only.customers/{customer_id}/campaigns/{campaign_id}tracking_url_template, final_urls, or mobile_final_urls.// Example Campaign
const campaign = {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 3,
base_campaign: 'customers/9262111890/campaigns/1568629385',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1624493702',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1568629385,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: false,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1568629385',
serving_status: 2,
start_date: '2018-09-19',
status: 4,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
}Get a Campaign
The customer.campaigns.get(resource_name) method returns the Campaign identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Campaign
Returns
Returns that Campaign as an object.
// Getting the entity
let result = await customer.campaigns.get('customers/9262111890/campaigns/1568629385')// Example result
;({
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 3,
base_campaign: 'customers/9262111890/campaigns/1568629385',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1624493702',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1568629385,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: false,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1568629385',
serving_status: 2,
start_date: '2018-09-19',
status: 4,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
})List every instance of Campaign
The customer.campaigns.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Campaign.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign property. Any other resources that can be selected with campaign will also be added as properities.
// Listing all the campaigns in the account
let result = await customer.campaigns.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaigns.list({
constraints: [
{
key: 'campaign.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign.some_field.sub_field',
})// Example result
;[
{
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 3,
base_campaign: 'customers/9262111890/campaigns/1568629385',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1624493702',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1568629385,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: false,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1568629385',
serving_status: 2,
start_date: '2018-09-19',
status: 4,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
campaign_budget: {
amount_micros: 12000000,
delivery_method: 2,
explicitly_shared: false,
has_recommended_budget: false,
id: 1624493702,
name: 'My campaign budget',
period: 2,
reference_count: 0,
resource_name: 'customers/9262111890/campaignBudgets/1624493702',
status: 3,
type: 2,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a Campaign
The customer.campaigns.create(campaign) method makes a new Campaign in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Campaign object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign = {
// Your Campaign here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaigns.create(campaign)
// Passing in an array of entities to create, validating only
const result = await customer.campaigns.create([campaign, other_campaign], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaigns/1568629385'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a Campaign
The customer.campaigns.update(campaign) method changes the attributes of an existing campaigns in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Campaign object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign = {
resource_name: 'customers/9262111890/campaigns/1568629385', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaigns.update(campaign)
// Passing in an array of entities to update, validating only
const result = await customer.campaigns.update([campaign, other_campaign], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaigns/1568629385'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a Campaign
The customer.campaigns.delete(resource_name) sets the status field of a Campaign to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that Campaign
Returns
Nothing
// Deleting the entity
await customer.campaigns.delete('customers/9262111890/campaigns/1568629385')CampaignBidModifier
The CampaignBidModifier object
Fields
customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}// Example CampaignBidModifier
const campaign_bid_modifier = {
campaign: 'customers/3827277046/campaigns/881817006',
criterion_id: 8000,
resource_name: 'customers/3827277046/campaignBidModifiers/881817006~8000',
}Get a CampaignBidModifier
The customer.campaignBidModifiers.get(resource_name) method returns the CampaignBidModifier identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignBidModifier
Returns
Returns that CampaignBidModifier as an object.
// Getting the entity
let result = await customer.campaignBidModifiers.get('customers/3827277046/campaignBidModifiers/881817006~8000')// Example result
;({
campaign: 'customers/3827277046/campaigns/881817006',
criterion_id: 8000,
resource_name: 'customers/3827277046/campaignBidModifiers/881817006~8000',
})List every instance of CampaignBidModifier
The customer.campaignBidModifiers.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignBidModifier.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_bid_modifier property. Any other resources that can be selected with campaign_bid_modifier will also be added as properities.
// Listing all the campaignBidModifiers in the account
let result = await customer.campaignBidModifiers.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignBidModifiers.list({
constraints: [
{
key: 'campaign_bid_modifier.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_bid_modifier.some_field.sub_field',
})// Example result
;[
{
campaign_bid_modifier: {
campaign: 'customers/3827277046/campaigns/881817006',
criterion_id: 8000,
resource_name: 'customers/3827277046/campaignBidModifiers/881817006~8000',
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/881817006',
bidding_strategy_type: 9,
campaign_budget: 'customers/3827277046/campaignBudgets/1159840470',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 881817006,
labels: ['customers/3827277046/labels/898377018'],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/881817006',
serving_status: 2,
start_date: '2017-07-12',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
tracking_url_template:
'https://ad.atdmt.com/s/go;adv=11202207688256;ec=11202207688723;c.a={campaignid};s.a=google;p.a={campaignid};as.a={adgroupid};qpb=1;?bidkw={keyword:defaultkeyword}&dvc={device}&h={lpurl}?utm_source=adwords&utm_medium=PPC&utm_campaign={campaignid}&utm_term={ifsearch:{keyword}}{ifcontent:{placement}}&utm_content={creative}&network={network}&adgroupid={adgroupid}&matchtype={matchtype}&adposition={adposition}&targetid={targetid}&target={target}&device={device}&devicemodel={devicemodel}',
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a CampaignBidModifier
The customer.campaignBidModifiers.create(campaign_bid_modifier) method makes a new CampaignBidModifier in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignBidModifier object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign_bid_modifier = {
// Your CampaignBidModifier here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaignBidModifiers.create(campaign_bid_modifier)
// Passing in an array of entities to create, validating only
const result = await customer.campaignBidModifiers.create([campaign_bid_modifier, other_campaign_bid_modifier], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/campaignBidModifiers/881817006~8000'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CampaignBidModifier
The customer.campaignBidModifiers.update(campaign_bid_modifier) method changes the attributes of an existing campaignBidModifiers in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignBidModifier object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign_bid_modifier = {
resource_name: 'customers/3827277046/campaignBidModifiers/881817006~8000', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaignBidModifiers.update(campaign_bid_modifier)
// Passing in an array of entities to update, validating only
const result = await customer.campaignBidModifiers.update([campaign_bid_modifier, other_campaign_bid_modifier], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/campaignBidModifiers/881817006~8000'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CampaignBidModifier
The customer.campaignBidModifiers.delete(resource_name) sets the status field of a CampaignBidModifier to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CampaignBidModifier
Returns
Nothing
// Deleting the entity
await customer.campaignBidModifiers.delete('customers/3827277046/campaignBidModifiers/881817006~8000')CampaignBudget
The CampaignBudget object
Fields
customers/{customer_id}/campaignBudgets/{budget_id}// Example CampaignBudget
const campaign_budget = {
amount_micros: 12000000,
delivery_method: 2,
explicitly_shared: false,
has_recommended_budget: false,
id: 1624493702,
name: 'My campaign budget',
period: 2,
reference_count: 0,
resource_name: 'customers/9262111890/campaignBudgets/1624493702',
status: 3,
type: 2,
}Get a CampaignBudget
The customer.campaignBudgets.get(resource_name) method returns the CampaignBudget identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignBudget
Returns
Returns that CampaignBudget as an object.
// Getting the entity
let result = await customer.campaignBudgets.get('customers/9262111890/campaignBudgets/1624493702')// Example result
;({
amount_micros: 12000000,
delivery_method: 2,
explicitly_shared: false,
has_recommended_budget: false,
id: 1624493702,
name: 'My campaign budget',
period: 2,
reference_count: 0,
resource_name: 'customers/9262111890/campaignBudgets/1624493702',
status: 3,
type: 2,
})List every instance of CampaignBudget
The customer.campaignBudgets.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignBudget.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_budget property. Any other resources that can be selected with campaign_budget will also be added as properities.
// Listing all the campaignBudgets in the account
let result = await customer.campaignBudgets.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignBudgets.list({
constraints: [
{
key: 'campaign_budget.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_budget.some_field.sub_field',
})// Example result
;[
{
campaign_budget: {
amount_micros: 12000000,
delivery_method: 2,
explicitly_shared: false,
has_recommended_budget: false,
id: 1624493702,
name: 'My campaign budget',
period: 2,
reference_count: 0,
resource_name: 'customers/9262111890/campaignBudgets/1624493702',
status: 3,
type: 2,
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 3,
base_campaign: 'customers/9262111890/campaigns/1568629385',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1624493702',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1568629385,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: true,
target_google_search: false,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1568629385',
serving_status: 2,
start_date: '2018-09-19',
status: 4,
target_spend: { cpc_bid_ceiling_micros: 1000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CampaignBudget
The customer.campaignBudgets.create(campaign_budget) method makes a new CampaignBudget in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignBudget object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign_budget = {
// Your CampaignBudget here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaignBudgets.create(campaign_budget)
// Passing in an array of entities to create, validating only
const result = await customer.campaignBudgets.create([campaign_budget, other_campaign_budget], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaignBudgets/1624493702'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CampaignBudget
The customer.campaignBudgets.update(campaign_budget) method changes the attributes of an existing campaignBudgets in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignBudget object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign_budget = {
resource_name: 'customers/9262111890/campaignBudgets/1624493702', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaignBudgets.update(campaign_budget)
// Passing in an array of entities to update, validating only
const result = await customer.campaignBudgets.update([campaign_budget, other_campaign_budget], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaignBudgets/1624493702'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CampaignBudget
The customer.campaignBudgets.delete(resource_name) sets the status field of a CampaignBudget to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CampaignBudget
Returns
Nothing
// Deleting the entity
await customer.campaignBudgets.delete('customers/9262111890/campaignBudgets/1624493702')CampaignCriterion
The CampaignCriterion object
Fields
- ad_schedule objectImmutable. Ad Schedule.
- age_range objectImmutable. Age range.
- carrier objectImmutable. Carrier.
- content_label objectImmutable. ContentLabel.
- custom_affinity objectImmutable. Custom Affinity.
- device objectImmutable. Device.
- gender objectImmutable. Gender.
- income_range objectImmutable. Income range.
- ip_block objectImmutable. IpBlock.
- keyword objectImmutable. Keyword.
- language objectImmutable. Language.
- listing_scope objectImmutable. Listing scope.
- location objectImmutable. Location.
- location_group objectImmutable. Location Group
- mobile_app_category objectImmutable. Mobile app category.
- mobile_application objectImmutable. Mobile application.
- mobile_device objectImmutable. Mobile Device.
- operating_system_version objectImmutable. Operating system version.
- parental_status objectImmutable. Parental status.
- placement objectImmutable. Placement.
- proximity objectImmutable. Proximity.
- topic objectImmutable. Topic.
- user_interest objectImmutable. User Interest.
- user_list objectImmutable. User List.
- webpage objectImmutable. Webpage.
- youtube_channel objectImmutable. YouTube Channel.
- youtube_video objectImmutable. YouTube Video.
false) or exclude (true) the criterion.customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}// Example CampaignCriterion
const campaign_criterion = {
campaign: 'customers/9262111890/campaigns/1483704368',
criterion_id: 1000,
language: { language_constant: 'languageConstants/1000' },
negative: false,
resource_name: 'customers/9262111890/campaignCriteria/1483704368~1000',
status: 2,
type: 20,
}Get a CampaignCriterion
The customer.campaignCriteria.get(resource_name) method returns the CampaignCriterion identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignCriterion
Returns
Returns that CampaignCriterion as an object.
// Getting the entity
let result = await customer.campaignCriteria.get('customers/9262111890/campaignCriteria/1483704368~1000')// Example result
;({
campaign: 'customers/9262111890/campaigns/1483704368',
criterion_id: 1000,
language: { language_constant: 'languageConstants/1000' },
negative: false,
resource_name: 'customers/9262111890/campaignCriteria/1483704368~1000',
status: 2,
type: 20,
})List every instance of CampaignCriterion
The customer.campaignCriteria.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignCriterion.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_criterion property. Any other resources that can be selected with campaign_criterion will also be added as properities.
// Listing all the campaignCriteria in the account
let result = await customer.campaignCriteria.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignCriteria.list({
constraints: [
{
key: 'campaign_criterion.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_criterion.some_field.sub_field',
})// Example result
;[
{
campaign_criterion: {
campaign: 'customers/9262111890/campaigns/1483704368',
criterion_id: 1000,
language: { language_constant: 'languageConstants/1000' },
negative: false,
resource_name: 'customers/9262111890/campaignCriteria/1483704368~1000',
status: 2,
type: 20,
},
language_constant: {
code: 'en',
id: 1000,
name: 'My language constant',
resource_name: 'languageConstants/1000',
targetable: true,
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/9262111890/campaigns/1483704368',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1547508174',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1483704368,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1483704368',
serving_status: 2,
start_date: '2018-07-23',
status: 2,
target_spend: { cpc_bid_ceiling_micros: 12000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CampaignCriterion
The customer.campaignCriteria.create(campaign_criterion) method makes a new CampaignCriterion in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignCriterion object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign_criterion = {
// Your CampaignCriterion here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaignCriteria.create(campaign_criterion)
// Passing in an array of entities to create, validating only
const result = await customer.campaignCriteria.create([campaign_criterion, other_campaign_criterion], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaignCriteria/1483704368~1000'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CampaignCriterion
The customer.campaignCriteria.update(campaign_criterion) method changes the attributes of an existing campaignCriteria in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignCriterion object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign_criterion = {
resource_name: 'customers/9262111890/campaignCriteria/1483704368~1000', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaignCriteria.update(campaign_criterion)
// Passing in an array of entities to update, validating only
const result = await customer.campaignCriteria.update([campaign_criterion, other_campaign_criterion], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaignCriteria/1483704368~1000'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CampaignCriterion
The customer.campaignCriteria.delete(resource_name) sets the status field of a CampaignCriterion to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CampaignCriterion
Returns
Nothing
// Deleting the entity
await customer.campaignCriteria.delete('customers/9262111890/campaignCriteria/1483704368~1000')CampaignCriterionSimulation
The CampaignCriterionSimulation object
Fields
customers/{customer_id}/campaignCriterionSimulations/{campaign_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}// Example CampaignCriterionSimulation
const campaign_criterion_simulation = {
bid_modifier_point_list: {
points: [
{
bid_modifier: 0.2,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 3630000,
impressions: 141,
top_slot_impressions: 94,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 70,
parent_cost_micros: 451520000,
parent_impressions: 1605,
parent_top_slot_impressions: 1349,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.34,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 3630000,
impressions: 157,
top_slot_impressions: 114,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 70,
parent_cost_micros: 451520000,
parent_impressions: 1621,
parent_top_slot_impressions: 1369,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.45,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 13060000,
impressions: 176,
top_slot_impressions: 131,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 72,
parent_cost_micros: 460950000,
parent_impressions: 1640,
parent_top_slot_impressions: 1386,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.48,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 6,
cost_micros: 16090000,
impressions: 190,
top_slot_impressions: 149,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 73,
parent_cost_micros: 463980000,
parent_impressions: 1654,
parent_top_slot_impressions: 1404,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.49,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 7,
cost_micros: 19470000,
impressions: 204,
top_slot_impressions: 163,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 74,
parent_cost_micros: 467360000,
parent_impressions: 1668,
parent_top_slot_impressions: 1418,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.59,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 8,
cost_micros: 25000000,
impressions: 220,
top_slot_impressions: 181,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 75,
parent_cost_micros: 472890000,
parent_impressions: 1684,
parent_top_slot_impressions: 1436,
parent_required_budget_micros: 90410000,
},
{
bid_modifier: 0.77,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 37330000,
impressions: 236,
top_slot_impressions: 201,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 76,
parent_cost_micros: 485220000,
parent_impressions: 1700,
parent_top_slot_impressions: 1456,
parent_required_budget_micros: 91090000,
},
{
bid_modifier: 1,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 48160000,
impressions: 252,
top_slot_impressions: 220,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 76,
parent_cost_micros: 496050000,
parent_impressions: 1716,
parent_top_slot_impressions: 1475,
parent_required_budget_micros: 92690000,
},
{
bid_modifier: 1.82,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 10,
cost_micros: 84630000,
impressions: 272,
top_slot_impressions: 234,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 77,
parent_cost_micros: 532520000,
parent_impressions: 1736,
parent_top_slot_impressions: 1489,
parent_required_budget_micros: 94830000,
},
{
bid_modifier: 4.51,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 10,
cost_micros: 89710000,
impressions: 296,
top_slot_impressions: 244,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 77,
parent_cost_micros: 537600000,
parent_impressions: 1760,
parent_top_slot_impressions: 1499,
parent_required_budget_micros: 99910000,
},
],
},
campaign_id: 2081620945,
criterion_id: 30001,
end_date: '2020-07-17',
modification_method: 2,
resource_name:
'customers/3827277046/campaignCriterionSimulations/2081620945~30001~BID_MODIFIER~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 5,
}Get a CampaignCriterionSimulation
The customer.campaignCriterionSimulations.get(resource_name) method returns the CampaignCriterionSimulation identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignCriterionSimulation
Returns
Returns that CampaignCriterionSimulation as an object.
// Getting the entity
let result = await customer.campaignCriterionSimulations.get(
'customers/3827277046/campaignCriterionSimulations/2081620945~30001~BID_MODIFIER~UNIFORM~20200711~20200717'
)// Example result
;({
bid_modifier_point_list: {
points: [
{
bid_modifier: 0.2,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 3630000,
impressions: 141,
top_slot_impressions: 94,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 70,
parent_cost_micros: 451520000,
parent_impressions: 1605,
parent_top_slot_impressions: 1349,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.34,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 3630000,
impressions: 157,
top_slot_impressions: 114,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 70,
parent_cost_micros: 451520000,
parent_impressions: 1621,
parent_top_slot_impressions: 1369,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.45,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 13060000,
impressions: 176,
top_slot_impressions: 131,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 72,
parent_cost_micros: 460950000,
parent_impressions: 1640,
parent_top_slot_impressions: 1386,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.48,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 6,
cost_micros: 16090000,
impressions: 190,
top_slot_impressions: 149,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 73,
parent_cost_micros: 463980000,
parent_impressions: 1654,
parent_top_slot_impressions: 1404,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.49,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 7,
cost_micros: 19470000,
impressions: 204,
top_slot_impressions: 163,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 74,
parent_cost_micros: 467360000,
parent_impressions: 1668,
parent_top_slot_impressions: 1418,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.59,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 8,
cost_micros: 25000000,
impressions: 220,
top_slot_impressions: 181,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 75,
parent_cost_micros: 472890000,
parent_impressions: 1684,
parent_top_slot_impressions: 1436,
parent_required_budget_micros: 90410000,
},
{
bid_modifier: 0.77,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 37330000,
impressions: 236,
top_slot_impressions: 201,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 76,
parent_cost_micros: 485220000,
parent_impressions: 1700,
parent_top_slot_impressions: 1456,
parent_required_budget_micros: 91090000,
},
{
bid_modifier: 1,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 48160000,
impressions: 252,
top_slot_impressions: 220,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 76,
parent_cost_micros: 496050000,
parent_impressions: 1716,
parent_top_slot_impressions: 1475,
parent_required_budget_micros: 92690000,
},
{
bid_modifier: 1.82,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 10,
cost_micros: 84630000,
impressions: 272,
top_slot_impressions: 234,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 77,
parent_cost_micros: 532520000,
parent_impressions: 1736,
parent_top_slot_impressions: 1489,
parent_required_budget_micros: 94830000,
},
{
bid_modifier: 4.51,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 10,
cost_micros: 89710000,
impressions: 296,
top_slot_impressions: 244,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 77,
parent_cost_micros: 537600000,
parent_impressions: 1760,
parent_top_slot_impressions: 1499,
parent_required_budget_micros: 99910000,
},
],
},
campaign_id: 2081620945,
criterion_id: 30001,
end_date: '2020-07-17',
modification_method: 2,
resource_name:
'customers/3827277046/campaignCriterionSimulations/2081620945~30001~BID_MODIFIER~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 5,
})List every instance of CampaignCriterionSimulation
The customer.campaignCriterionSimulations.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignCriterionSimulation.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_criterion_simulation property. Any other resources that can be selected with campaign_criterion_simulation will also be added as properities.
// Listing all the campaignCriterionSimulations in the account
let result = await customer.campaignCriterionSimulations.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignCriterionSimulations.list({
constraints: [
{
key: 'campaign_criterion_simulation.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_criterion_simulation.some_field.sub_field',
})// Example result
;[
{
campaign_criterion_simulation: {
bid_modifier_point_list: {
points: [
{
bid_modifier: 0.2,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 3630000,
impressions: 141,
top_slot_impressions: 94,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 70,
parent_cost_micros: 451520000,
parent_impressions: 1605,
parent_top_slot_impressions: 1349,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.34,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 3,
cost_micros: 3630000,
impressions: 157,
top_slot_impressions: 114,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 70,
parent_cost_micros: 451520000,
parent_impressions: 1621,
parent_top_slot_impressions: 1369,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.45,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 5,
cost_micros: 13060000,
impressions: 176,
top_slot_impressions: 131,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 72,
parent_cost_micros: 460950000,
parent_impressions: 1640,
parent_top_slot_impressions: 1386,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.48,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 6,
cost_micros: 16090000,
impressions: 190,
top_slot_impressions: 149,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 73,
parent_cost_micros: 463980000,
parent_impressions: 1654,
parent_top_slot_impressions: 1404,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.49,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 7,
cost_micros: 19470000,
impressions: 204,
top_slot_impressions: 163,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 74,
parent_cost_micros: 467360000,
parent_impressions: 1668,
parent_top_slot_impressions: 1418,
parent_required_budget_micros: 88250000,
},
{
bid_modifier: 0.59,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 8,
cost_micros: 25000000,
impressions: 220,
top_slot_impressions: 181,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 75,
parent_cost_micros: 472890000,
parent_impressions: 1684,
parent_top_slot_impressions: 1436,
parent_required_budget_micros: 90410000,
},
{
bid_modifier: 0.77,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 37330000,
impressions: 236,
top_slot_impressions: 201,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 76,
parent_cost_micros: 485220000,
parent_impressions: 1700,
parent_top_slot_impressions: 1456,
parent_required_budget_micros: 91090000,
},
{
bid_modifier: 1,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 9,
cost_micros: 48160000,
impressions: 252,
top_slot_impressions: 220,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 76,
parent_cost_micros: 496050000,
parent_impressions: 1716,
parent_top_slot_impressions: 1475,
parent_required_budget_micros: 92690000,
},
{
bid_modifier: 1.82,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 10,
cost_micros: 84630000,
impressions: 272,
top_slot_impressions: 234,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 77,
parent_cost_micros: 532520000,
parent_impressions: 1736,
parent_top_slot_impressions: 1489,
parent_required_budget_micros: 94830000,
},
{
bid_modifier: 4.51,
biddable_conversions: 0,
biddable_conversions_value: 0,
clicks: 10,
cost_micros: 89710000,
impressions: 296,
top_slot_impressions: 244,
parent_biddable_conversions: 0,
parent_biddable_conversions_value: 0,
parent_clicks: 77,
parent_cost_micros: 537600000,
parent_impressions: 1760,
parent_top_slot_impressions: 1499,
parent_required_budget_micros: 99910000,
},
],
},
campaign_id: 2081620945,
criterion_id: 30001,
end_date: '2020-07-17',
modification_method: 2,
resource_name:
'customers/3827277046/campaignCriterionSimulations/2081620945~30001~BID_MODIFIER~UNIFORM~20200711~20200717',
start_date: '2020-07-11',
type: 5,
},
campaign_criterion: {
campaign: 'customers/3827277046/campaigns/2081620945',
criterion_id: 30001,
device: { type: 2 },
negative: false,
resource_name: 'customers/3827277046/campaignCriteria/2081620945~30001',
status: 2,
type: 6,
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/2081620945',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/6449346159',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 5, positive_geo_target_type: 7 },
id: 2081620945,
labels: [
'customers/3827277046/labels/3889728216',
'customers/3827277046/labels/3889728468',
'customers/3827277046/labels/3889728480',
],
manual_cpc: { enhanced_cpc_enabled: true },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
optimization_score: 0.7376711477461586,
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/2081620945',
serving_status: 2,
start_date: '2019-07-30',
status: 2,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: true }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]CampaignExtensionSetting
The CampaignExtensionSetting object
Fields
customers/{customer_id}/campaigns/{campaign_id}customers/{customer_id}/extensionFeedItems/{feed_item_id}customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}// Example CampaignExtensionSetting
const campaign_extension_setting = {
campaign: 'customers/9262111890/campaigns/1483704368',
device: 0,
extension_feed_items: [
'customers/9262111890/extensionFeedItems/51842193961',
'customers/9262111890/extensionFeedItems/51842200495',
'customers/9262111890/extensionFeedItems/51844020102',
'customers/9262111890/extensionFeedItems/51844028388',
],
extension_type: 10,
resource_name: 'customers/9262111890/campaignExtensionSettings/1483704368~SITELINK',
}Get a CampaignExtensionSetting
The customer.campaignExtensionSettings.get(resource_name) method returns the CampaignExtensionSetting identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignExtensionSetting
Returns
Returns that CampaignExtensionSetting as an object.
// Getting the entity
let result = await customer.campaignExtensionSettings.get(
'customers/9262111890/campaignExtensionSettings/1483704368~SITELINK'
)// Example result
;({
campaign: 'customers/9262111890/campaigns/1483704368',
device: 0,
extension_feed_items: [
'customers/9262111890/extensionFeedItems/51842193961',
'customers/9262111890/extensionFeedItems/51842200495',
'customers/9262111890/extensionFeedItems/51844020102',
'customers/9262111890/extensionFeedItems/51844028388',
],
extension_type: 10,
resource_name: 'customers/9262111890/campaignExtensionSettings/1483704368~SITELINK',
})List every instance of CampaignExtensionSetting
The customer.campaignExtensionSettings.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignExtensionSetting.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_extension_setting property. Any other resources that can be selected with campaign_extension_setting will also be added as properities.
// Listing all the campaignExtensionSettings in the account
let result = await customer.campaignExtensionSettings.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignExtensionSettings.list({
constraints: [
{
key: 'campaign_extension_setting.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_extension_setting.some_field.sub_field',
})// Example result
;[
{
campaign_extension_setting: {
campaign: 'customers/9262111890/campaigns/1483704368',
device: 0,
extension_feed_items: [
'customers/9262111890/extensionFeedItems/51842193961',
'customers/9262111890/extensionFeedItems/51842200495',
'customers/9262111890/extensionFeedItems/51844020102',
'customers/9262111890/extensionFeedItems/51844028388',
],
extension_type: 10,
resource_name: 'customers/9262111890/campaignExtensionSettings/1483704368~SITELINK',
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/9262111890/campaigns/1483704368',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1547508174',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1483704368,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1483704368',
serving_status: 2,
start_date: '2018-07-23',
status: 2,
target_spend: { cpc_bid_ceiling_micros: 12000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CampaignExtensionSetting
The customer.campaignExtensionSettings.create(campaign_extension_setting) method makes a new CampaignExtensionSetting in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignExtensionSetting object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign_extension_setting = {
// Your CampaignExtensionSetting here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaignExtensionSettings.create(campaign_extension_setting)
// Passing in an array of entities to create, validating only
const result = await customer.campaignExtensionSettings.create(
[campaign_extension_setting, other_campaign_extension_setting],
{
validate_only: true,
}
)// Example result
{
results : ['customers/9262111890/campaignExtensionSettings/1483704368~SITELINK'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CampaignExtensionSetting
The customer.campaignExtensionSettings.update(campaign_extension_setting) method changes the attributes of an existing campaignExtensionSettings in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignExtensionSetting object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign_extension_setting = {
resource_name: 'customers/9262111890/campaignExtensionSettings/1483704368~SITELINK', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaignExtensionSettings.update(campaign_extension_setting)
// Passing in an array of entities to update, validating only
const result = await customer.campaignExtensionSettings.update(
[campaign_extension_setting, other_campaign_extension_setting],
{
validate_only: true,
}
)// Example result
{
results : ['customers/9262111890/campaignExtensionSettings/1483704368~SITELINK'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CampaignExtensionSetting
The customer.campaignExtensionSettings.delete(resource_name) sets the status field of a CampaignExtensionSetting to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CampaignExtensionSetting
Returns
Nothing
// Deleting the entity
await customer.campaignExtensionSettings.delete('customers/9262111890/campaignExtensionSettings/1483704368~SITELINK')CampaignFeed
The CampaignFeed object
Fields
// Example CampaignFeed
const campaign_feed = {
campaign: 'customers/9262111890/campaigns/1483704368',
feed: 'customers/9262111890/feeds/82896692',
matching_function: {
function_string: 'IN(FEED_ITEM_ID,{51842193961,51842200495,51844020102,51844028388})',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 2,
right_operands: [
{ constant_operand: { long_value: 51842193961 } },
{ constant_operand: { long_value: 51842200495 } },
{ constant_operand: { long_value: 51844020102 } },
{ constant_operand: { long_value: 51844028388 } },
],
},
placeholder_types: [],
resource_name: 'customers/9262111890/campaignFeeds/1483704368~82896692',
status: 2,
}Get a CampaignFeed
The customer.campaignFeeds.get(resource_name) method returns the CampaignFeed identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignFeed
Returns
Returns that CampaignFeed as an object.
// Getting the entity
let result = await customer.campaignFeeds.get('customers/9262111890/campaignFeeds/1483704368~82896692')// Example result
;({
campaign: 'customers/9262111890/campaigns/1483704368',
feed: 'customers/9262111890/feeds/82896692',
matching_function: {
function_string: 'IN(FEED_ITEM_ID,{51842193961,51842200495,51844020102,51844028388})',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 2,
right_operands: [
{ constant_operand: { long_value: 51842193961 } },
{ constant_operand: { long_value: 51842200495 } },
{ constant_operand: { long_value: 51844020102 } },
{ constant_operand: { long_value: 51844028388 } },
],
},
placeholder_types: [],
resource_name: 'customers/9262111890/campaignFeeds/1483704368~82896692',
status: 2,
})List every instance of CampaignFeed
The customer.campaignFeeds.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignFeed.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_feed property. Any other resources that can be selected with campaign_feed will also be added as properities.
// Listing all the campaignFeeds in the account
let result = await customer.campaignFeeds.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignFeeds.list({
constraints: [
{
key: 'campaign_feed.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_feed.some_field.sub_field',
})// Example result
;[
{
campaign_feed: {
campaign: 'customers/9262111890/campaigns/1483704368',
feed: 'customers/9262111890/feeds/82896692',
matching_function: {
function_string: 'IN(FEED_ITEM_ID,{51842193961,51842200495,51844020102,51844028388})',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 2,
right_operands: [
{ constant_operand: { long_value: 51842193961 } },
{ constant_operand: { long_value: 51842200495 } },
{ constant_operand: { long_value: 51844020102 } },
{ constant_operand: { long_value: 51844028388 } },
],
},
placeholder_types: [],
resource_name: 'customers/9262111890/campaignFeeds/1483704368~82896692',
status: 2,
},
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/9262111890/campaigns/1483704368',
bidding_strategy_type: 9,
campaign_budget: 'customers/9262111890/campaignBudgets/1547508174',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1483704368,
labels: [],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/9262111890/campaigns/1483704368',
serving_status: 2,
start_date: '2018-07-23',
status: 2,
target_spend: { cpc_bid_ceiling_micros: 12000000 },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CampaignFeed
The customer.campaignFeeds.create(campaign_feed) method makes a new CampaignFeed in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignFeed object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign_feed = {
// Your CampaignFeed here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaignFeeds.create(campaign_feed)
// Passing in an array of entities to create, validating only
const result = await customer.campaignFeeds.create([campaign_feed, other_campaign_feed], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaignFeeds/1483704368~82896692'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CampaignFeed
The customer.campaignFeeds.update(campaign_feed) method changes the attributes of an existing campaignFeeds in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignFeed object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign_feed = {
resource_name: 'customers/9262111890/campaignFeeds/1483704368~82896692', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaignFeeds.update(campaign_feed)
// Passing in an array of entities to update, validating only
const result = await customer.campaignFeeds.update([campaign_feed, other_campaign_feed], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/campaignFeeds/1483704368~82896692'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CampaignFeed
The customer.campaignFeeds.delete(resource_name) sets the status field of a CampaignFeed to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CampaignFeed
Returns
Nothing
// Deleting the entity
await customer.campaignFeeds.delete('customers/9262111890/campaignFeeds/1483704368~82896692')CampaignLabel
The CampaignLabel object
Fields
customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}// Example CampaignLabel
const campaign_label = {
campaign: 'customers/3827277046/campaigns/881817006',
label: 'customers/3827277046/labels/898377018',
resource_name: 'customers/3827277046/campaignLabels/881817006~898377018',
}Get a CampaignLabel
The customer.campaignLabels.get(resource_name) method returns the CampaignLabel identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CampaignLabel
Returns
Returns that CampaignLabel as an object.
// Getting the entity
let result = await customer.campaignLabels.get('customers/3827277046/campaignLabels/881817006~898377018')// Example result
;({
campaign: 'customers/3827277046/campaigns/881817006',
label: 'customers/3827277046/labels/898377018',
resource_name: 'customers/3827277046/campaignLabels/881817006~898377018',
})List every instance of CampaignLabel
The customer.campaignLabels.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CampaignLabel.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a campaign_label property. Any other resources that can be selected with campaign_label will also be added as properities.
// Listing all the campaignLabels in the account
let result = await customer.campaignLabels.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.campaignLabels.list({
constraints: [
{
key: 'campaign_label.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'campaign_label.some_field.sub_field',
})// Example result
;[
{
campaign_label: {
campaign: 'customers/3827277046/campaigns/881817006',
label: 'customers/3827277046/labels/898377018',
resource_name: 'customers/3827277046/campaignLabels/881817006~898377018',
},
label: {
id: 898377018,
name: 'My label',
resource_name: 'customers/3827277046/labels/898377018',
status: 2,
text_label: { background_color: '#ccccff', description: '' },
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/881817006',
bidding_strategy_type: 9,
campaign_budget: 'customers/3827277046/campaignBudgets/1159840470',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 881817006,
labels: ['customers/3827277046/labels/898377018'],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/881817006',
serving_status: 2,
start_date: '2017-07-12',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
tracking_url_template:
'https://ad.atdmt.com/s/go;adv=11202207688256;ec=11202207688723;c.a={campaignid};s.a=google;p.a={campaignid};as.a={adgroupid};qpb=1;?bidkw={keyword:defaultkeyword}&dvc={device}&h={lpurl}?utm_source=adwords&utm_medium=PPC&utm_campaign={campaignid}&utm_term={ifsearch:{keyword}}{ifcontent:{placement}}&utm_content={creative}&network={network}&adgroupid={adgroupid}&matchtype={matchtype}&adposition={adposition}&targetid={targetid}&target={target}&device={device}&devicemodel={devicemodel}',
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a CampaignLabel
The customer.campaignLabels.create(campaign_label) method makes a new CampaignLabel in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignLabel object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const campaign_label = {
// Your CampaignLabel here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.campaignLabels.create(campaign_label)
// Passing in an array of entities to create, validating only
const result = await customer.campaignLabels.create([campaign_label, other_campaign_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/campaignLabels/881817006~898377018'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CampaignLabel
The customer.campaignLabels.update(campaign_label) method changes the attributes of an existing campaignLabels in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CampaignLabel object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const campaign_label = {
resource_name: 'customers/3827277046/campaignLabels/881817006~898377018', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.campaignLabels.update(campaign_label)
// Passing in an array of entities to update, validating only
const result = await customer.campaignLabels.update([campaign_label, other_campaign_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/campaignLabels/881817006~898377018'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CampaignLabel
The customer.campaignLabels.delete(resource_name) sets the status field of a CampaignLabel to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CampaignLabel
Returns
Nothing
// Deleting the entity
await customer.campaignLabels.delete('customers/3827277046/campaignLabels/881817006~898377018')CarrierConstant
The CarrierConstant object
Fields
carrierConstants/{criterion_id}// Example CarrierConstant
const carrier_constant = {
country_code: 'TW',
id: 70720,
name: 'Long Distance & Mobile Business Group',
resource_name: 'carrierConstants/70720',
}Get a CarrierConstant
The customer.carrierConstants.get(resource_name) method returns the CarrierConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CarrierConstant
Returns
Returns that CarrierConstant as an object.
// Getting the entity
let result = await customer.carrierConstants.get('carrierConstants/70720')// Example result
;({
country_code: 'TW',
id: 70720,
name: 'Long Distance & Mobile Business Group',
resource_name: 'carrierConstants/70720',
})List every instance of CarrierConstant
The customer.carrierConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CarrierConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a carrier_constant property. Any other resources that can be selected with carrier_constant will also be added as properities.
// Listing all the carrierConstants in the account
let result = await customer.carrierConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.carrierConstants.list({
constraints: [
{
key: 'carrier_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'carrier_constant.some_field.sub_field',
})// Example result
;[
{
carrier_constant: {
country_code: 'TW',
id: 70720,
name: 'Long Distance & Mobile Business Group',
resource_name: 'carrierConstants/70720',
},
},
]ChangeStatus
The ChangeStatus object
Fields
customers/{customer_id}/changeStatus/{change_status_id}// Example ChangeStatus
const change_status = {
feed: 'customers/9262111890/feeds/82896692',
feed_item: 'customers/9262111890/feedItems/82896692~51844020102',
last_change_date_time: '2020-07-13 09:01:10.844783',
resource_name: 'customers/9262111890/changeStatus/1594627270844783-10-82896692-51844020102',
resource_status: 3,
resource_type: 10,
}Get a ChangeStatus
The customer.changeStatus.get(resource_name) method returns the ChangeStatus identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that ChangeStatus
Returns
Returns that ChangeStatus as an object.
// Getting the entity
let result = await customer.changeStatus.get(
'customers/9262111890/changeStatus/1594627270844783-10-82896692-51844020102'
)// Example result
;({
feed: 'customers/9262111890/feeds/82896692',
feed_item: 'customers/9262111890/feedItems/82896692~51844020102',
last_change_date_time: '2020-07-13 09:01:10.844783',
resource_name: 'customers/9262111890/changeStatus/1594627270844783-10-82896692-51844020102',
resource_status: 3,
resource_type: 10,
})List every instance of ChangeStatus
The customer.changeStatus.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of ChangeStatus.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a change_status property. Any other resources that can be selected with change_status will also be added as properities.
// Listing all the changeStatus in the account
let result = await customer.changeStatus.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.changeStatus.list({
constraints: [
{
key: 'change_status.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'change_status.some_field.sub_field',
})// Example result
;[
{
change_status: {
feed: 'customers/9262111890/feeds/82896692',
feed_item: 'customers/9262111890/feedItems/82896692~51844020102',
last_change_date_time: '2020-07-13 09:01:10.844783',
resource_name: 'customers/9262111890/changeStatus/1594627270844783-10-82896692-51844020102',
resource_status: 3,
resource_type: 10,
},
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
},
feed_item: {
attribute_values: [
{
feed_attribute_id: 1,
string_value: 'my sitelink text',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 3,
string_value: 'description here',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 4,
string_value: 'description here line 2',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 5,
integer_values_list: [],
boolean_values_list: [],
string_values_list: ['https://myurl.com'],
double_values_list: [],
},
],
feed: 'customers/9262111890/feeds/82896692',
geo_targeting_restriction: 0,
id: 51844020102,
policy_infos: [
{
placeholder_type_enum: 2,
feed_mapping_resource_name: 'customers/9262111890/feedMappings/82896692~91300060',
review_status: 0,
approval_status: 0,
policy_topic_entries_list: [],
validation_status: 4,
validation_errors_list: [],
quality_approval_status: 0,
quality_disapproval_reasons_list: [],
},
],
resource_name: 'customers/9262111890/feedItems/82896692~51844020102',
status: 2,
url_custom_parameters: [],
},
ad_group: {
ad_rotation_mode: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
id: 0,
labels: [],
resource_name: '',
status: 0,
type: 0,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 0,
advertising_channel_sub_type: 0,
advertising_channel_type: 0,
bidding_strategy_type: 0,
experiment_type: 0,
frequency_caps: [],
id: 0,
labels: [],
payment_mode: 0,
resource_name: '',
serving_status: 0,
status: 0,
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]ConversionAction
The ConversionAction object
Fields
customers/{customer_id}/conversionActions/{conversion_action_id}// Example ConversionAction
const conversion_action = {
attribution_model_settings: { attribution_model: 105, data_driven_model_status: 5 },
category: 5,
click_through_lookback_window_days: 7,
counting_type: 3,
id: 314732636,
include_in_conversions_metric: true,
mobile_app_vendor: 1,
name: 'My conversion action',
owner_customer: 'customers/9262111890',
phone_call_duration_seconds: 60,
resource_name: 'customers/9262111890/conversionActions/314732636',
status: 3,
tag_snippets: [
{
type: 3,
page_format: 2,
global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
event_snippet:
"<!-- Event snippet for test-conversion-action-6661770 (created during library test) conversion page\nIn your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->\n<script>\nfunction gtag_report_conversion(url) {\n var callback = function () {\n if (typeof(url) != 'undefined') {\n window.location = url;\n }\n };\n gtag('event', 'conversion', {\n 'send_to': 'AW-797556569/5CprCNzgiZYBENn-pvwC',\n 'value': 5.0,\n 'currency': 'USD',\n 'event_callback': callback\n });\n return false;\n}\n</script>\n",
},
{
type: 3,
page_format: 3,
global_site_tag:
'<!-- Global site tag (gtag) - Google Ads: 797556569 -->\n<amp-analytics type="gtag" data-credentials="include">\n<script type="application/json">\n{\n "vars": {\n "gtag_id": "AW-797556569",\n "config": {\n "AW-797556569": {\n "groups": "default"\n }\n }\n },\n "triggers": {\n }\n}\n</script>\n</amp-analytics>\n',
event_snippet:
'"C_yfcHXCUzChg": {\n "on": "click",\n "selector": "CSS_SELECTOR",\n "vars": {\n "event_name": "conversion",\n "value": 5.0,\n "currency": "USD",\n "send_to": ["AW-797556569/5CprCNzgiZYBENn-pvwC"]\n }\n}\n',
},
{
type: 2,
page_format: 2,
global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
event_snippet:
"<!-- Event snippet for test-conversion-action-6661770 (created during library test) conversion page -->\n<script>\n gtag('event', 'conversion', {\n 'send_to': 'AW-797556569/5CprCNzgiZYBENn-pvwC',\n 'value': 5.0,\n 'currency': 'USD'\n });\n</script>\n",
},
{
type: 2,
page_format: 3,
global_site_tag:
'<!-- Global site tag (gtag) - Google Ads: 797556569 -->\n<amp-analytics type="gtag" data-credentials="include">\n<script type="application/json">\n{\n "vars": {\n "gtag_id": "AW-797556569",\n "config": {\n "AW-797556569": {\n "groups": "default"\n }\n }\n },\n "triggers": {\n }\n}\n</script>\n</amp-analytics>\n',
event_snippet:
'"C_yfcHXCUzChg": {\n "on": "visible",\n "vars": {\n "event_name": "conversion",\n "value": 5.0,\n "currency": "USD",\n "send_to": ["AW-797556569/5CprCNzgiZYBENn-pvwC"]\n }\n}\n',
},
],
type: 8,
value_settings: { always_use_default_value: false, default_currency_code: 'USD', default_value: 5 },
view_through_lookback_window_days: 1,
}Get a ConversionAction
The customer.conversionActions.get(resource_name) method returns the ConversionAction identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that ConversionAction
Returns
Returns that ConversionAction as an object.
// Getting the entity
let result = await customer.conversionActions.get('customers/9262111890/conversionActions/314732636')// Example result
;({
attribution_model_settings: { attribution_model: 105, data_driven_model_status: 5 },
category: 5,
click_through_lookback_window_days: 7,
counting_type: 3,
id: 314732636,
include_in_conversions_metric: true,
mobile_app_vendor: 1,
name: 'My conversion action',
owner_customer: 'customers/9262111890',
phone_call_duration_seconds: 60,
resource_name: 'customers/9262111890/conversionActions/314732636',
status: 3,
tag_snippets: [
{
type: 3,
page_format: 2,
global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
event_snippet:
"<!-- Event snippet for test-conversion-action-6661770 (created during library test) conversion page\nIn your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->\n<script>\nfunction gtag_report_conversion(url) {\n var callback = function () {\n if (typeof(url) != 'undefined') {\n window.location = url;\n }\n };\n gtag('event', 'conversion', {\n 'send_to': 'AW-797556569/5CprCNzgiZYBENn-pvwC',\n 'value': 5.0,\n 'currency': 'USD',\n 'event_callback': callback\n });\n return false;\n}\n</script>\n",
},
{
type: 3,
page_format: 3,
global_site_tag:
'<!-- Global site tag (gtag) - Google Ads: 797556569 -->\n<amp-analytics type="gtag" data-credentials="include">\n<script type="application/json">\n{\n "vars": {\n "gtag_id": "AW-797556569",\n "config": {\n "AW-797556569": {\n "groups": "default"\n }\n }\n },\n "triggers": {\n }\n}\n</script>\n</amp-analytics>\n',
event_snippet:
'"C_yfcHXCUzChg": {\n "on": "click",\n "selector": "CSS_SELECTOR",\n "vars": {\n "event_name": "conversion",\n "value": 5.0,\n "currency": "USD",\n "send_to": ["AW-797556569/5CprCNzgiZYBENn-pvwC"]\n }\n}\n',
},
{
type: 2,
page_format: 2,
global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
event_snippet:
"<!-- Event snippet for test-conversion-action-6661770 (created during library test) conversion page -->\n<script>\n gtag('event', 'conversion', {\n 'send_to': 'AW-797556569/5CprCNzgiZYBENn-pvwC',\n 'value': 5.0,\n 'currency': 'USD'\n });\n</script>\n",
},
{
type: 2,
page_format: 3,
global_site_tag:
'<!-- Global site tag (gtag) - Google Ads: 797556569 -->\n<amp-analytics type="gtag" data-credentials="include">\n<script type="application/json">\n{\n "vars": {\n "gtag_id": "AW-797556569",\n "config": {\n "AW-797556569": {\n "groups": "default"\n }\n }\n },\n "triggers": {\n }\n}\n</script>\n</amp-analytics>\n',
event_snippet:
'"C_yfcHXCUzChg": {\n "on": "visible",\n "vars": {\n "event_name": "conversion",\n "value": 5.0,\n "currency": "USD",\n "send_to": ["AW-797556569/5CprCNzgiZYBENn-pvwC"]\n }\n}\n',
},
],
type: 8,
value_settings: { always_use_default_value: false, default_currency_code: 'USD', default_value: 5 },
view_through_lookback_window_days: 1,
})List every instance of ConversionAction
The customer.conversionActions.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of ConversionAction.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a conversion_action property. Any other resources that can be selected with conversion_action will also be added as properities.
// Listing all the conversionActions in the account
let result = await customer.conversionActions.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.conversionActions.list({
constraints: [
{
key: 'conversion_action.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'conversion_action.some_field.sub_field',
})// Example result
;[
{
conversion_action: {
attribution_model_settings: { attribution_model: 105, data_driven_model_status: 5 },
category: 5,
click_through_lookback_window_days: 7,
counting_type: 3,
id: 314732636,
include_in_conversions_metric: true,
mobile_app_vendor: 1,
name: 'My conversion action',
owner_customer: 'customers/9262111890',
phone_call_duration_seconds: 60,
resource_name: 'customers/9262111890/conversionActions/314732636',
status: 3,
tag_snippets: [
{
type: 3,
page_format: 2,
global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
event_snippet:
"<!-- Event snippet for test-conversion-action-6661770 (created during library test) conversion page\nIn your html page, add the snippet and call gtag_report_conversion when someone clicks on the chosen link or button. -->\n<script>\nfunction gtag_report_conversion(url) {\n var callback = function () {\n if (typeof(url) != 'undefined') {\n window.location = url;\n }\n };\n gtag('event', 'conversion', {\n 'send_to': 'AW-797556569/5CprCNzgiZYBENn-pvwC',\n 'value': 5.0,\n 'currency': 'USD',\n 'event_callback': callback\n });\n return false;\n}\n</script>\n",
},
{
type: 3,
page_format: 3,
global_site_tag:
'<!-- Global site tag (gtag) - Google Ads: 797556569 -->\n<amp-analytics type="gtag" data-credentials="include">\n<script type="application/json">\n{\n "vars": {\n "gtag_id": "AW-797556569",\n "config": {\n "AW-797556569": {\n "groups": "default"\n }\n }\n },\n "triggers": {\n }\n}\n</script>\n</amp-analytics>\n',
event_snippet:
'"C_yfcHXCUzChg": {\n "on": "click",\n "selector": "CSS_SELECTOR",\n "vars": {\n "event_name": "conversion",\n "value": 5.0,\n "currency": "USD",\n "send_to": ["AW-797556569/5CprCNzgiZYBENn-pvwC"]\n }\n}\n',
},
{
type: 2,
page_format: 2,
global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
event_snippet:
"<!-- Event snippet for test-conversion-action-6661770 (created during library test) conversion page -->\n<script>\n gtag('event', 'conversion', {\n 'send_to': 'AW-797556569/5CprCNzgiZYBENn-pvwC',\n 'value': 5.0,\n 'currency': 'USD'\n });\n</script>\n",
},
{
type: 2,
page_format: 3,
global_site_tag:
'<!-- Global site tag (gtag) - Google Ads: 797556569 -->\n<amp-analytics type="gtag" data-credentials="include">\n<script type="application/json">\n{\n "vars": {\n "gtag_id": "AW-797556569",\n "config": {\n "AW-797556569": {\n "groups": "default"\n }\n }\n },\n "triggers": {\n }\n}\n</script>\n</amp-analytics>\n',
event_snippet:
'"C_yfcHXCUzChg": {\n "on": "visible",\n "vars": {\n "event_name": "conversion",\n "value": 5.0,\n "currency": "USD",\n "send_to": ["AW-797556569/5CprCNzgiZYBENn-pvwC"]\n }\n}\n',
},
],
type: 8,
value_settings: { always_use_default_value: false, default_currency_code: 'USD', default_value: 5 },
view_through_lookback_window_days: 1,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a ConversionAction
The customer.conversionActions.create(conversion_action) method makes a new ConversionAction in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The ConversionAction object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const conversion_action = {
// Your ConversionAction here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.conversionActions.create(conversion_action)
// Passing in an array of entities to create, validating only
const result = await customer.conversionActions.create([conversion_action, other_conversion_action], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/conversionActions/314732636'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a ConversionAction
The customer.conversionActions.update(conversion_action) method changes the attributes of an existing conversionActions in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The ConversionAction object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const conversion_action = {
resource_name: 'customers/9262111890/conversionActions/314732636', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.conversionActions.update(conversion_action)
// Passing in an array of entities to update, validating only
const result = await customer.conversionActions.update([conversion_action, other_conversion_action], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/conversionActions/314732636'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a ConversionAction
The customer.conversionActions.delete(resource_name) sets the status field of a ConversionAction to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that ConversionAction
Returns
Nothing
// Deleting the entity
await customer.conversionActions.delete('customers/9262111890/conversionActions/314732636')ConversionUpload
Upload ConversionCalls
The customer.conversionUploads.uploadCallConversions(call_conversions) method uploads call conversions to an account. It requires an array of call conversions.
Arguments
-
entity required
An array of call conversions.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
-
all_results optional, boolean
Boolean adding
truewill return an array of all uploaded conversions, defaults tofalse
Returns
-
results
an array of information for successfully processed CallConversionUpload.
-
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// uploading CallConversions
const call_conversions: CallConversion[] = [
{
// Your CallConversion here
},
{
// Your CallConversion here
},
]
// Getting identifying information for all uploads
const result = await customer.conversionUploads.uploadCallConversions(call_conversions, {}, true)
// Getting identifying information for all uploads with options
const result = await customer.conversionUploads.uploadCallConversions(
call_conversions,
{
validate_only: true,
},
true
)
// Getting identifying information for the first uploaded item
const result = await customer.conversionUploads.uploadCallConversions(call_conversions)// Example result
{
results: [
{
caller_id: '+442087599036',
call_start_date_time: '2019-01-01 12:32:45-08:00',
conversion_action: `customer/${CID}/conversionAction/123123123`,
conversion_date_time: '2019-01-01 12:32:45-08:00',
}
],
partial_failure_error : null,
request: { /* your request object */ }
}Upload ConversionClicks
The customer.conversionUploads.uploadClickConversions(click_conversions) method uploads click conversions to an account. It requires an array of click conversions.
Arguments
-
entity required
An array of click conversions.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
-
all_results optional, boolean
Boolean adding
truewill return an array of all uploaded conversions, defaults tofalse
Returns
-
results
an array of information for successfully processed ClickConversionUpload.
-
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// uploading ClickConversions
const click_conversions: ClickConversion[] = [
{
// Your ClickConversion here
},
{
// Your ClickConversion here
},
]
// Getting identifying information for all uploads
const result = await customer.conversionUploads.uploadClickConversions(click_conversions, {}, true)
// Getting identifying information for all uploads with options
const result = await customer.conversionUploads.uploadClickConversions(
click_conversions,
{
validate_only: true,
},
true
)
// Getting identifying information for the first uploaded item
const result = await customer.conversionUploads.uploadClickConversions(click_conversions)// Example result
{
results: [
{
gclid: '42812402112',
conversion_action: 'beans',
conversion_date_time: '2019-01-01 12:32:45-08:00',
conversion_value: 320,
currency_code: 'GBP',
order_id: '32894129342',
external_attribution_data: {
external_attribution_credit: 925592,
external_attribution_model: 'heinz',
}
}
],
partial_failure_error : null,
request: { /* your request object */ }
}CustomInterest
The CustomInterest object
Fields
customers/{customer_id}/customInterests/{custom_interest_id}// Example CustomInterest
const custom_interest = {
description: '',
id: 13338354,
members: [
{ member_type: 2, parameter: 'ppc' },
{ member_type: 2, parameter: 'google adwords ppc campaign' },
{ member_type: 2, parameter: 'google adwords ppc advertising' },
{ member_type: 2, parameter: 'ppc and google adwords' },
{ member_type: 2, parameter: 'is google adwords ppc' },
{ member_type: 2, parameter: 'google adwords ppc cost' },
{ member_type: 2, parameter: 'ppc google advertising' },
{ member_type: 2, parameter: 'google ads ppc' },
{ member_type: 2, parameter: 'google ad word campaign' },
{ member_type: 2, parameter: 'google ppc marketing' },
{ member_type: 2, parameter: 'google advertising adwords' },
{ member_type: 2, parameter: 'google ppc campaign' },
{ member_type: 2, parameter: 'what is google ppc advertising' },
{ member_type: 2, parameter: 'adwords ppc campaign' },
{ member_type: 2, parameter: 'google ppc agency' },
{ member_type: 2, parameter: 'google adwords agency' },
{ member_type: 2, parameter: 'google ppc' },
{ member_type: 2, parameter: 'google ppc services' },
{ member_type: 2, parameter: 'google ppc cost' },
{ member_type: 2, parameter: 'what is google ppc' },
{ member_type: 2, parameter: 'google ppc courses' },
{ member_type: 2, parameter: 'google ads' },
{ member_type: 2, parameter: 'adwords' },
],
name: 'My custom interest',
resource_name: 'customers/3827277046/customInterests/13338354',
status: 2,
type: 3,
}Get a CustomInterest
The customer.customInterests.get(resource_name) method returns the CustomInterest identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomInterest
Returns
Returns that CustomInterest as an object.
// Getting the entity
let result = await customer.customInterests.get('customers/3827277046/customInterests/13338354')// Example result
;({
description: '',
id: 13338354,
members: [
{ member_type: 2, parameter: 'ppc' },
{ member_type: 2, parameter: 'google adwords ppc campaign' },
{ member_type: 2, parameter: 'google adwords ppc advertising' },
{ member_type: 2, parameter: 'ppc and google adwords' },
{ member_type: 2, parameter: 'is google adwords ppc' },
{ member_type: 2, parameter: 'google adwords ppc cost' },
{ member_type: 2, parameter: 'ppc google advertising' },
{ member_type: 2, parameter: 'google ads ppc' },
{ member_type: 2, parameter: 'google ad word campaign' },
{ member_type: 2, parameter: 'google ppc marketing' },
{ member_type: 2, parameter: 'google advertising adwords' },
{ member_type: 2, parameter: 'google ppc campaign' },
{ member_type: 2, parameter: 'what is google ppc advertising' },
{ member_type: 2, parameter: 'adwords ppc campaign' },
{ member_type: 2, parameter: 'google ppc agency' },
{ member_type: 2, parameter: 'google adwords agency' },
{ member_type: 2, parameter: 'google ppc' },
{ member_type: 2, parameter: 'google ppc services' },
{ member_type: 2, parameter: 'google ppc cost' },
{ member_type: 2, parameter: 'what is google ppc' },
{ member_type: 2, parameter: 'google ppc courses' },
{ member_type: 2, parameter: 'google ads' },
{ member_type: 2, parameter: 'adwords' },
],
name: 'My custom interest',
resource_name: 'customers/3827277046/customInterests/13338354',
status: 2,
type: 3,
})List every instance of CustomInterest
The customer.customInterests.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomInterest.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a custom_interest property. Any other resources that can be selected with custom_interest will also be added as properities.
// Listing all the customInterests in the account
let result = await customer.customInterests.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customInterests.list({
constraints: [
{
key: 'custom_interest.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'custom_interest.some_field.sub_field',
})// Example result
;[
{
custom_interest: {
description: '',
id: 13338354,
members: [
{ member_type: 2, parameter: 'ppc' },
{ member_type: 2, parameter: 'google adwords ppc campaign' },
{ member_type: 2, parameter: 'google adwords ppc advertising' },
{ member_type: 2, parameter: 'ppc and google adwords' },
{ member_type: 2, parameter: 'is google adwords ppc' },
{ member_type: 2, parameter: 'google adwords ppc cost' },
{ member_type: 2, parameter: 'ppc google advertising' },
{ member_type: 2, parameter: 'google ads ppc' },
{ member_type: 2, parameter: 'google ad word campaign' },
{ member_type: 2, parameter: 'google ppc marketing' },
{ member_type: 2, parameter: 'google advertising adwords' },
{ member_type: 2, parameter: 'google ppc campaign' },
{ member_type: 2, parameter: 'what is google ppc advertising' },
{ member_type: 2, parameter: 'adwords ppc campaign' },
{ member_type: 2, parameter: 'google ppc agency' },
{ member_type: 2, parameter: 'google adwords agency' },
{ member_type: 2, parameter: 'google ppc' },
{ member_type: 2, parameter: 'google ppc services' },
{ member_type: 2, parameter: 'google ppc cost' },
{ member_type: 2, parameter: 'what is google ppc' },
{ member_type: 2, parameter: 'google ppc courses' },
{ member_type: 2, parameter: 'google ads' },
{ member_type: 2, parameter: 'adwords' },
],
name: 'My custom interest',
resource_name: 'customers/3827277046/customInterests/13338354',
status: 2,
type: 3,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a CustomInterest
The customer.customInterests.create(custom_interest) method makes a new CustomInterest in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomInterest object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const custom_interest = {
// Your CustomInterest here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customInterests.create(custom_interest)
// Passing in an array of entities to create, validating only
const result = await customer.customInterests.create([custom_interest, other_custom_interest], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/customInterests/13338354'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomInterest
The customer.customInterests.update(custom_interest) method changes the attributes of an existing customInterests in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomInterest object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const custom_interest = {
resource_name: 'customers/3827277046/customInterests/13338354', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customInterests.update(custom_interest)
// Passing in an array of entities to update, validating only
const result = await customer.customInterests.update([custom_interest, other_custom_interest], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/customInterests/13338354'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomInterest
The customer.customInterests.delete(resource_name) sets the status field of a CustomInterest to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomInterest
Returns
Nothing
// Deleting the entity
await customer.customInterests.delete('customers/3827277046/customInterests/13338354')Customer
The customer resource is the root of all other resources in this library. On top of the usual self-get and self-mutate methods, it also features methods useful for reporting and mutations across several resource types.
The Customer object
Fields
customers/{customer_id}// Example Customer
const customer = {
resource_name: 'customers/9262111890',
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
test_account: true,
time_zone: 'Europe/London',
}Get a Customer
The customer.get(resource_name) method returns the Customer identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
id required
The ID (aka CID) of that customer, without dashes, such as
1231231234.
Returns
Returns that Customer as an object.
// Getting the entity
let result = await customer.get('9262111890')// Example result
;({
resource_name: 'customers/9262111890',
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
test_account: true,
time_zone: 'Europe/London',
})Query
The customer.query(gaql_string) method takes an SQL-like string and returns the queried rows. For more information about how and when to use this method, see the reporting section.
Arguments
-
gaql_string string, required
The SQL-like string.
Returns
An array of objects, each object containing the keys requested in the query.
const ads_with_urls = await customer.query(`
SELECT
ad_group.id,
ad_group_ad.ad.id,
ad_group_ad.ad.expanded_text_ad.headline_part1,
ad_group_ad.ad.text_ad.headline,
metrics.impressions
FROM
ad_group_ad
WHERE
campaign.status = ENABLED
AND ad_group_ad.ad.type IN ('TEXT_AD', 'EXPANDED_TEXT_AD')
AND metrics.impressions > 0
AND segments.date >= '2018-02-25'
AND segments.date <= '2019-03-01'
ORDER BY metrics.impressions DESC
LIMIT 3
`)// result rows
;[
{
ad_group: { resource_name: 'customers/3827277046/adGroups/45808681353', id: 45808681353 },
ad_group_ad: {
resource_name: 'customers/3827277046/adGroupAds/45808681353~266534257097',
ad: { expanded_text_ad: { headline_part_1: 'best ad ever' }, id: 266534257097 },
},
metrics: { impressions: 1473 },
},
{
ad_group: { resource_name: 'customers/3827277046/adGroups/45808681353', id: 45808681353 },
ad_group_ad: {
resource_name: 'customers/3827277046/adGroupAds/45808681353~304364243717',
ad: { expanded_text_ad: { headline_part_1: 'next best ad' }, id: 304364243717 },
},
metrics: { impressions: 959 },
},
{
ad_group: { resource_name: 'customers/3827277046/adGroups/69639056868', id: 69639056868 },
ad_group_ad: {
resource_name: 'customers/3827277046/adGroupAds/69639056868~307847364192',
ad: { text_ad: { headline: 'pretty okay ad i guess' }, id: 307847364192 },
},
metrics: { impressions: 533 },
},
]Report
The customer.report() method is very similar to customer.query, except that it takes a query-building object as an argument. For more information about why this is a good idea, see the reporting section
Arguments
-
query object, required
An object of the form:
-
entity string, required
The resource to query. All core resources can be queried, as well as the views defined in the official docs. Note that this field expects resources in
snake_case. -
attributes array, optional
The attributes to query. Check the core resource on this page to see which attributes are available.
-
metrics array, optional
The metrics to query.
-
segments array, optional
The segments to split your metrics by. Note that segments will increase your number of result rows, and that attributes will simply be repeated.
-
constraints array, optional
Constraints should be provided as an array. Each constraint is of the form:
-
key string, required
The field that you are applying a constraint on.
-
op string, required
The operator, such as
=orNOT IN. -
val required
The value to check. This can either be a string or an enum.
Since this is quite verbose, we have a few of shorthands explained in the example code to the right.
-
-
date_constant string, optional
One of the date constants defined in the query grammar, such as
LAST_30_DAYS -
from_date string, optional
The start date for any metrics in your query. Only valid if
date_constantis not defined. -
to_date string, optional
The end date for any metrics in your query. Defaults to today. Only valid if
date_constantis not defined. -
limit number, optional
The number of rows to return. Useful when used with
order_by. -
order_by string, optional
The field to order your results by.
-
sort_order string, optional
The order direction. Either
DESCorASC -
page_size number, optional
This library handles paging automatically. If the number of returned rows is larger than the page size, it will paginate through result sets and return all of the results when done. Defaults to
10,000.
-
Returns
An array of objects, each object containing the keys requested in the query.
// This example will generate the same results as the query() call above
let ads_with_urls = await customer.report({
entity: 'ad_group_ad',
attributes: [
'ad_group_ad.ad.id',
'ad_group.id',
'ad_group_ad.ad.expanded_text_ad.headline_part1',
'ad_group_ad.ad.text_ad.headline',
],
metrics: ['metrics.impressions'],
constraints: [
{ key: 'metrics.impressions', op: '>', val: 0 },
{
'ad_group_ad.ad.type': [enums.AdType.TEXT_AD, enums.AdType.EXPANDED_TEXT_AD],
},
],
from_date: '2018-02-25',
to_date: '2019-03-01',
order_by: 'metrics.impressions',
sort_order: 'DESC',
limit: 3,
})// result rows
;[
{
ad_group: { resource_name: 'customers/3827277046/adGroups/45808681353', id: 45808681353 },
ad_group_ad: {
resource_name: 'customers/3827277046/adGroupAds/45808681353~266534257097',
ad: { expanded_text_ad: { headline_part_1: 'best ad ever' }, id: 266534257097 },
},
metrics: { impressions: 1473 },
},
{
ad_group: { resource_name: 'customers/3827277046/adGroups/45808681353', id: 45808681353 },
ad_group_ad: {
resource_name: 'customers/3827277046/adGroupAds/45808681353~304364243717',
ad: { expanded_text_ad: { headline_part_1: 'next best ad' }, id: 304364243717 },
},
metrics: { impressions: 959 },
},
{
ad_group: { resource_name: 'customers/3827277046/adGroups/69639056868', id: 69639056868 },
ad_group_ad: {
resource_name: 'customers/3827277046/adGroupAds/69639056868~307847364192',
ad: { text_ad: { headline: 'pretty okay ad i guess' }, id: 307847364192 },
},
metrics: { impressions: 533 },
},
]// Constraint shorthands
constraints = [
// clicks > 0, with no shorthand
{ key: 'metrics.clicks', op: '>', val: 0 },
// campaign.name = "my campaign", with object shorthand for "="
{ 'campaign.name': '"my campaign"' },
// campaign.status = "PAUSED", with object shorthand for "=" on enum
{ 'campaign.status': enums.CampaignStatus.PAUSED },
// campaign.status IN ("PAUSED", "ENABLED"), with array shorthand for "IN"
{ 'campaign.status': [enums.CampaignStatus.PAUSED, enums.CampaignStatus.ENABLED] },
]
// If all constraints are using "=" or "IN", the whole contraints key can be an object instead of an array.
constraints = {
'campaign.name': '"my campaign"',
'campaign.status': [enums.CampaignStatus.PAUSED, enums.CampaignStatus.ENABLED],
}Mutate several of different resource types in one call
The customer.mutateResources(resources_array) method takes an array of operations, where each operation is mutation to a resource, performs all of these mutations in sequence. By default, a call to customer.mutateResources() is atomic -- either all operations succeed or everything is rolled back.
Arguments
-
operations required, array
An array of operations. Each operation looks just like a resource with a few extra keys. They are of the form:
-
_resource: string, required
The resource type of this operation, such as
CampaignorAdGroupAd. All mutable core resources are valid. This string is in TitleCase format. -
_operation: string, optional
The mutation type of this operation. Can be
create,update, ordelete. Defaults tocreate. -
resource_name string
The resource_name of the resource you are operating on. Required for
updateanddeleteoperations, optional forcreateoperations. When creating a resource, if you need to reference this resource in a future operation, use a negative integer as an ID, such as-1. -
(other_fields)
Any other fields valid for this resource, such as
name.
-
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
When
false, a single failure in the array of operations will cause the whole sequence to be rolled back. Whentrue, the system will attempt to perform the next operations. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
const response = await customer.mutateResources([
// Create new budget
{
_resource: 'CampaignBudget',
_operation: 'create',
resource_name: 'customers/3827277046/campaignBudgets/-1',
name: 'My new budget',
amount_micros: 3000000,
explicitly_shared: true,
},
// Update campaign to use the new budget and have a new name
{
_resource: 'Campaign',
_operation: 'update',
name: 'New name for my campaign with a new budget'
resource_name: 'customers/3827277046/campaigns/456456456',
campaign_budget: 'customers/3827277046/campaignBudgets/-1',
},
// Delete old budget
{
_resource: 'CampaignBudget',
_operation: 'delete',
resource_name: 'customers/3827277046/campaignBudgets/123123',
},
]){
results : [
'customers/3827277046/campaignBudgets/265265547' // created
'customers/3827277046/campaigns/456456456' // updated
'customers/3827277046/campaignBugets/123123' // deleted
],
partial_failure_error : null,
request: { /* your request object */ }
}CustomerClient
The CustomerClient object
Fields
customers/{customer_id}/customerClients/{client_customer_id}// Example CustomerClient
const customer_client = {
client_customer: 'customers/9262111890',
currency_code: 'EUR',
descriptive_name: 'My customer client',
hidden: false,
id: 9262111890,
level: 0,
manager: false,
resource_name: 'customers/9262111890/customerClients/9262111890',
test_account: true,
time_zone: 'Europe/London',
}Get a CustomerClient
The customer.customerClients.get(resource_name) method returns the CustomerClient identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerClient
Returns
Returns that CustomerClient as an object.
// Getting the entity
let result = await customer.customerClients.get('customers/9262111890/customerClients/9262111890')// Example result
;({
client_customer: 'customers/9262111890',
currency_code: 'EUR',
descriptive_name: 'My customer client',
hidden: false,
id: 9262111890,
level: 0,
manager: false,
resource_name: 'customers/9262111890/customerClients/9262111890',
test_account: true,
time_zone: 'Europe/London',
})List every instance of CustomerClient
The customer.customerClients.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerClient.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_client property. Any other resources that can be selected with customer_client will also be added as properities.
// Listing all the customerClients in the account
let result = await customer.customerClients.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerClients.list({
constraints: [
{
key: 'customer_client.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_client.some_field.sub_field',
})// Example result
;[
{
customer_client: {
client_customer: 'customers/9262111890',
currency_code: 'EUR',
descriptive_name: 'My customer client',
hidden: false,
id: 9262111890,
level: 0,
manager: false,
resource_name: 'customers/9262111890/customerClients/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]CustomerClientLink
The CustomerClientLink object
Fields
customers/{customer_id}/customerClientLinks/{client_customer_id}~{manager_link_id}// Example CustomerClientLink
const customer_client_link = /* Todo: add example get() return here */Get a CustomerClientLink
The customer.customerClientLinks.get(resource_name) method returns the CustomerClientLink identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerClientLink
Returns
Returns that CustomerClientLink as an object.
// Getting the entity
let result = await customer.customerClientLinks.get('customers/1234567890/customerClientLinks/123123123')// Example result
(/* Todo: add example get() return here */)List every instance of CustomerClientLink
The customer.customerClientLinks.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerClientLink.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_client_link property. Any other resources that can be selected with customer_client_link will also be added as properities.
// Listing all the customerClientLinks in the account
let result = await customer.customerClientLinks.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerClientLinks.list({
constraints: [
{
key: 'customer_client_link.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_client_link.some_field.sub_field',
})// Example result
;[
/* Todo: add example list() return here */
]Create a CustomerClientLink
The customer.customerClientLinks.create(customer_client_link) method makes a new CustomerClientLink in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerClientLink object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const customer_client_link = {
// Your CustomerClientLink here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customerClientLinks.create(customer_client_link)
// Passing in an array of entities to create, validating only
const result = await customer.customerClientLinks.create([customer_client_link, other_customer_client_link], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/customerClientLinks/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomerClientLink
The customer.customerClientLinks.update(customer_client_link) method changes the attributes of an existing customerClientLinks in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerClientLink object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const customer_client_link = {
resource_name: 'customers/1234567890/customerClientLinks/123123123', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customerClientLinks.update(customer_client_link)
// Passing in an array of entities to update, validating only
const result = await customer.customerClientLinks.update([customer_client_link, other_customer_client_link], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/customerClientLinks/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomerClientLink
The customer.customerClientLinks.delete(resource_name) sets the status field of a CustomerClientLink to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomerClientLink
Returns
Nothing
// Deleting the entity
await customer.customerClientLinks.delete('customers/1234567890/customerClientLinks/123123123')CustomerExtensionSetting
The CustomerExtensionSetting object
Fields
customers/{customer_id}/extensionFeedItems/{feed_item_id}customers/{customer_id}/customerExtensionSettings/{extension_type}// Example CustomerExtensionSetting
const customer_extension_setting = {
device: 0,
extension_feed_items: ['customers/9262111890/extensionFeedItems/51842375274'],
extension_type: 11,
resource_name: 'customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET',
}Get a CustomerExtensionSetting
The customer.customerExtensionSettings.get(resource_name) method returns the CustomerExtensionSetting identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerExtensionSetting
Returns
Returns that CustomerExtensionSetting as an object.
// Getting the entity
let result = await customer.customerExtensionSettings.get(
'customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET'
)// Example result
;({
device: 0,
extension_feed_items: ['customers/9262111890/extensionFeedItems/51842375274'],
extension_type: 11,
resource_name: 'customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET',
})List every instance of CustomerExtensionSetting
The customer.customerExtensionSettings.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerExtensionSetting.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_extension_setting property. Any other resources that can be selected with customer_extension_setting will also be added as properities.
// Listing all the customerExtensionSettings in the account
let result = await customer.customerExtensionSettings.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerExtensionSettings.list({
constraints: [
{
key: 'customer_extension_setting.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_extension_setting.some_field.sub_field',
})// Example result
;[
{
customer_extension_setting: {
device: 0,
extension_feed_items: ['customers/9262111890/extensionFeedItems/51842375274'],
extension_type: 11,
resource_name: 'customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET',
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CustomerExtensionSetting
The customer.customerExtensionSettings.create(customer_extension_setting) method makes a new CustomerExtensionSetting in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerExtensionSetting object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const customer_extension_setting = {
// Your CustomerExtensionSetting here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customerExtensionSettings.create(customer_extension_setting)
// Passing in an array of entities to create, validating only
const result = await customer.customerExtensionSettings.create(
[customer_extension_setting, other_customer_extension_setting],
{
validate_only: true,
}
)// Example result
{
results : ['customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomerExtensionSetting
The customer.customerExtensionSettings.update(customer_extension_setting) method changes the attributes of an existing customerExtensionSettings in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerExtensionSetting object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const customer_extension_setting = {
resource_name: 'customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customerExtensionSettings.update(customer_extension_setting)
// Passing in an array of entities to update, validating only
const result = await customer.customerExtensionSettings.update(
[customer_extension_setting, other_customer_extension_setting],
{
validate_only: true,
}
)// Example result
{
results : ['customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomerExtensionSetting
The customer.customerExtensionSettings.delete(resource_name) sets the status field of a CustomerExtensionSetting to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomerExtensionSetting
Returns
Nothing
// Deleting the entity
await customer.customerExtensionSettings.delete('customers/9262111890/customerExtensionSettings/STRUCTURED_SNIPPET')CustomerFeed
The CustomerFeed object
Fields
customers/{customer_id}/customerFeeds/{feed_id}// Example CustomerFeed
const customer_feed = {
feed: 'customers/9262111890/feeds/82896692',
matching_function: {
function_string: 'EQUALS(FEED_ITEM_ID,51840594005)',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 4,
right_operands: [{ constant_operand: { long_value: 51840594005 } }],
},
placeholder_types: [],
resource_name: 'customers/9262111890/customerFeeds/82896692',
status: 2,
}Get a CustomerFeed
The customer.customerFeeds.get(resource_name) method returns the CustomerFeed identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerFeed
Returns
Returns that CustomerFeed as an object.
// Getting the entity
let result = await customer.customerFeeds.get('customers/9262111890/customerFeeds/82896692')// Example result
;({
feed: 'customers/9262111890/feeds/82896692',
matching_function: {
function_string: 'EQUALS(FEED_ITEM_ID,51840594005)',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 4,
right_operands: [{ constant_operand: { long_value: 51840594005 } }],
},
placeholder_types: [],
resource_name: 'customers/9262111890/customerFeeds/82896692',
status: 2,
})List every instance of CustomerFeed
The customer.customerFeeds.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerFeed.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_feed property. Any other resources that can be selected with customer_feed will also be added as properities.
// Listing all the customerFeeds in the account
let result = await customer.customerFeeds.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerFeeds.list({
constraints: [
{
key: 'customer_feed.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_feed.some_field.sub_field',
})// Example result
;[
{
customer_feed: {
feed: 'customers/9262111890/feeds/82896692',
matching_function: {
function_string: 'EQUALS(FEED_ITEM_ID,51840594005)',
left_operands: [{ request_context_operand: { context_type: 2 } }],
operator: 4,
right_operands: [{ constant_operand: { long_value: 51840594005 } }],
},
placeholder_types: [],
resource_name: 'customers/9262111890/customerFeeds/82896692',
status: 2,
},
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CustomerFeed
The customer.customerFeeds.create(customer_feed) method makes a new CustomerFeed in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerFeed object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const customer_feed = {
// Your CustomerFeed here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customerFeeds.create(customer_feed)
// Passing in an array of entities to create, validating only
const result = await customer.customerFeeds.create([customer_feed, other_customer_feed], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/customerFeeds/82896692'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomerFeed
The customer.customerFeeds.update(customer_feed) method changes the attributes of an existing customerFeeds in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerFeed object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const customer_feed = {
resource_name: 'customers/9262111890/customerFeeds/82896692', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customerFeeds.update(customer_feed)
// Passing in an array of entities to update, validating only
const result = await customer.customerFeeds.update([customer_feed, other_customer_feed], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/customerFeeds/82896692'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomerFeed
The customer.customerFeeds.delete(resource_name) sets the status field of a CustomerFeed to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomerFeed
Returns
Nothing
// Deleting the entity
await customer.customerFeeds.delete('customers/9262111890/customerFeeds/82896692')CustomerLabel
The CustomerLabel object
Fields
customers/{customer_id}/customerLabels/{label_id}// Example CustomerLabel
const customer_label = /* Todo: add example get() return here */Get a CustomerLabel
The customer.customerLabels.get(resource_name) method returns the CustomerLabel identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerLabel
Returns
Returns that CustomerLabel as an object.
// Getting the entity
let result = await customer.customerLabels.get('customers/1234567890/customerLabels/123123123')// Example result
(/* Todo: add example get() return here */)List every instance of CustomerLabel
The customer.customerLabels.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerLabel.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_label property. Any other resources that can be selected with customer_label will also be added as properities.
// Listing all the customerLabels in the account
let result = await customer.customerLabels.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerLabels.list({
constraints: [
{
key: 'customer_label.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_label.some_field.sub_field',
})// Example result
;[
/* Todo: add example list() return here */
]Create a CustomerLabel
The customer.customerLabels.create(customer_label) method makes a new CustomerLabel in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerLabel object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const customer_label = {
// Your CustomerLabel here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customerLabels.create(customer_label)
// Passing in an array of entities to create, validating only
const result = await customer.customerLabels.create([customer_label, other_customer_label], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/customerLabels/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomerLabel
The customer.customerLabels.update(customer_label) method changes the attributes of an existing customerLabels in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerLabel object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const customer_label = {
resource_name: 'customers/1234567890/customerLabels/123123123', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customerLabels.update(customer_label)
// Passing in an array of entities to update, validating only
const result = await customer.customerLabels.update([customer_label, other_customer_label], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/customerLabels/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomerLabel
The customer.customerLabels.delete(resource_name) sets the status field of a CustomerLabel to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomerLabel
Returns
Nothing
// Deleting the entity
await customer.customerLabels.delete('customers/1234567890/customerLabels/123123123')CustomerManagerLink
The CustomerManagerLink object
Fields
customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}// Example CustomerManagerLink
const customer_manager_link = {
manager_customer: 'customers/6141549892',
manager_link_id: 121665495,
resource_name: 'customers/9262111890/customerManagerLinks/6141549892~121665495',
status: 2,
}Get a CustomerManagerLink
The customer.customerManagerLinks.get(resource_name) method returns the CustomerManagerLink identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerManagerLink
Returns
Returns that CustomerManagerLink as an object.
// Getting the entity
let result = await customer.customerManagerLinks.get('customers/9262111890/customerManagerLinks/6141549892~121665495')// Example result
;({
manager_customer: 'customers/6141549892',
manager_link_id: 121665495,
resource_name: 'customers/9262111890/customerManagerLinks/6141549892~121665495',
status: 2,
})List every instance of CustomerManagerLink
The customer.customerManagerLinks.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerManagerLink.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_manager_link property. Any other resources that can be selected with customer_manager_link will also be added as properities.
// Listing all the customerManagerLinks in the account
let result = await customer.customerManagerLinks.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerManagerLinks.list({
constraints: [
{
key: 'customer_manager_link.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_manager_link.some_field.sub_field',
})// Example result
;[
{
customer_manager_link: {
manager_customer: 'customers/6141549892',
manager_link_id: 121665495,
resource_name: 'customers/9262111890/customerManagerLinks/6141549892~121665495',
status: 2,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a CustomerManagerLink
The customer.customerManagerLinks.create(customer_manager_link) method makes a new CustomerManagerLink in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerManagerLink object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const customer_manager_link = {
// Your CustomerManagerLink here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customerManagerLinks.create(customer_manager_link)
// Passing in an array of entities to create, validating only
const result = await customer.customerManagerLinks.create([customer_manager_link, other_customer_manager_link], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/customerManagerLinks/6141549892~121665495'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomerManagerLink
The customer.customerManagerLinks.update(customer_manager_link) method changes the attributes of an existing customerManagerLinks in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerManagerLink object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const customer_manager_link = {
resource_name: 'customers/9262111890/customerManagerLinks/6141549892~121665495', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customerManagerLinks.update(customer_manager_link)
// Passing in an array of entities to update, validating only
const result = await customer.customerManagerLinks.update([customer_manager_link, other_customer_manager_link], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/customerManagerLinks/6141549892~121665495'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomerManagerLink
The customer.customerManagerLinks.delete(resource_name) sets the status field of a CustomerManagerLink to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomerManagerLink
Returns
Nothing
// Deleting the entity
await customer.customerManagerLinks.delete('customers/9262111890/customerManagerLinks/6141549892~121665495')CustomerNegativeCriterion
The CustomerNegativeCriterion object
Fields
- content_label objectImmutable. ContentLabel.
- mobile_app_category objectImmutable. MobileAppCategory.
- mobile_application objectImmutable. MobileApplication.
- placement objectImmutable. Placement.
- youtube_channel objectImmutable. YouTube Channel.
- youtube_video objectImmutable. YouTube Video.
customers/{customer_id}/customerNegativeCriteria/{criterion_id}// Example CustomerNegativeCriterion
const customer_negative_criterion = {
id: 61276056204,
mobile_application: {
app_id: '2-com.duolingo',
name: 'Mobile App: Duolingo: Learn Languages Free (Google Play), by Duolingo',
},
resource_name: 'customers/3827277046/customerNegativeCriteria/61276056204',
type: 5,
}Get a CustomerNegativeCriterion
The customer.customerNegativeCriteria.get(resource_name) method returns the CustomerNegativeCriterion identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that CustomerNegativeCriterion
Returns
Returns that CustomerNegativeCriterion as an object.
// Getting the entity
let result = await customer.customerNegativeCriteria.get('customers/3827277046/customerNegativeCriteria/61276056204')// Example result
;({
id: 61276056204,
mobile_application: {
app_id: '2-com.duolingo',
name: 'Mobile App: Duolingo: Learn Languages Free (Google Play), by Duolingo',
},
resource_name: 'customers/3827277046/customerNegativeCriteria/61276056204',
type: 5,
})List every instance of CustomerNegativeCriterion
The customer.customerNegativeCriteria.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of CustomerNegativeCriterion.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a customer_negative_criterion property. Any other resources that can be selected with customer_negative_criterion will also be added as properities.
// Listing all the customerNegativeCriteria in the account
let result = await customer.customerNegativeCriteria.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.customerNegativeCriteria.list({
constraints: [
{
key: 'customer_negative_criterion.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'customer_negative_criterion.some_field.sub_field',
})// Example result
;[
{
customer_negative_criterion: {
id: 61276056204,
mobile_application: {
app_id: '2-com.duolingo',
name: 'Mobile App: Duolingo: Learn Languages Free (Google Play), by Duolingo',
},
resource_name: 'customers/3827277046/customerNegativeCriteria/61276056204',
type: 5,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a CustomerNegativeCriterion
The customer.customerNegativeCriteria.create(customer_negative_criterion) method makes a new CustomerNegativeCriterion in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerNegativeCriterion object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const customer_negative_criterion = {
// Your CustomerNegativeCriterion here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.customerNegativeCriteria.create(customer_negative_criterion)
// Passing in an array of entities to create, validating only
const result = await customer.customerNegativeCriteria.create(
[customer_negative_criterion, other_customer_negative_criterion],
{
validate_only: true,
}
)// Example result
{
results : ['customers/3827277046/customerNegativeCriteria/61276056204'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a CustomerNegativeCriterion
The customer.customerNegativeCriteria.update(customer_negative_criterion) method changes the attributes of an existing customerNegativeCriteria in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The CustomerNegativeCriterion object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const customer_negative_criterion = {
resource_name: 'customers/3827277046/customerNegativeCriteria/61276056204', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.customerNegativeCriteria.update(customer_negative_criterion)
// Passing in an array of entities to update, validating only
const result = await customer.customerNegativeCriteria.update(
[customer_negative_criterion, other_customer_negative_criterion],
{
validate_only: true,
}
)// Example result
{
results : ['customers/3827277046/customerNegativeCriteria/61276056204'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a CustomerNegativeCriterion
The customer.customerNegativeCriteria.delete(resource_name) sets the status field of a CustomerNegativeCriterion to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that CustomerNegativeCriterion
Returns
Nothing
// Deleting the entity
await customer.customerNegativeCriteria.delete('customers/3827277046/customerNegativeCriteria/61276056204')DomainCategory
The DomainCategory object
Fields
customers/{customer_id}/domainCategories/{campaign_id}~{category_base64}~{language_code}// Example DomainCategory
const domain_category = {
campaign: 'customers/3827277046/campaigns/1398201241',
category: 'landing pages from your standard ad groups',
category_rank: 0,
coverage_fraction: 2.7777777777777777,
domain: 'opteo.com',
has_children: false,
language_code: 'en',
recommended_cpc_bid_micros: 6626250,
resource_name:
'customers/3827277046/domainCategories/1398201241~bGFuZGluZyBwYWdlcyBmcm9tIHlvdXIgc3RhbmRhcmQgYWQgZ3JvdXBz~en',
}Get a DomainCategory
The customer.domainCategories.get(resource_name) method returns the DomainCategory identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that DomainCategory
Returns
Returns that DomainCategory as an object.
// Getting the entity
let result = await customer.domainCategories.get(
'customers/3827277046/domainCategories/1398201241~bGFuZGluZyBwYWdlcyBmcm9tIHlvdXIgc3RhbmRhcmQgYWQgZ3JvdXBz~en'
)// Example result
;({
campaign: 'customers/3827277046/campaigns/1398201241',
category: 'landing pages from your standard ad groups',
category_rank: 0,
coverage_fraction: 2.7777777777777777,
domain: 'opteo.com',
has_children: false,
language_code: 'en',
recommended_cpc_bid_micros: 6626250,
resource_name:
'customers/3827277046/domainCategories/1398201241~bGFuZGluZyBwYWdlcyBmcm9tIHlvdXIgc3RhbmRhcmQgYWQgZ3JvdXBz~en',
})List every instance of DomainCategory
The customer.domainCategories.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of DomainCategory.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a domain_category property. Any other resources that can be selected with domain_category will also be added as properities.
// Listing all the domainCategories in the account
let result = await customer.domainCategories.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.domainCategories.list({
constraints: [
{
key: 'domain_category.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'domain_category.some_field.sub_field',
})// Example result
;[
{
domain_category: {
campaign: 'customers/3827277046/campaigns/1398201241',
category: 'landing pages from your standard ad groups',
category_rank: 0,
coverage_fraction: 2.7777777777777777,
domain: 'opteo.com',
has_children: false,
language_code: 'en',
recommended_cpc_bid_micros: 6626250,
resource_name:
'customers/3827277046/domainCategories/1398201241~bGFuZGluZyBwYWdlcyBmcm9tIHlvdXIgc3RhbmRhcmQgYWQgZ3JvdXBz~en',
},
campaign: {
ad_serving_optimization_status: 5,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/1398201241',
bidding_strategy: 'customers/3827277046/biddingStrategies/2053936084',
bidding_strategy_type: 8,
campaign_budget: 'customers/3827277046/campaignBudgets/1453179506',
dynamic_search_ads_setting: {
domain_name: 'opteo.com',
feeds: [],
language_code: 'en',
use_supplied_urls_only: false,
},
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 5 },
id: 1398201241,
labels: [
'customers/3827277046/labels/3889728216',
'customers/3827277046/labels/3889728468',
'customers/3827277046/labels/3889728474',
],
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/1398201241',
serving_status: 2,
start_date: '2018-05-10',
status: 3,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]ExtensionFeedItem
The ExtensionFeedItem object
Fields
- affiliate_location_feed_item objectOutput only. Affiliate location extension. Feed locations are populated by Google Ads based on a chain ID. This field is read-only.
- app_feed_item objectApp extension.
- call_feed_item objectCall extension.
- callout_feed_item objectCallout extension.
- hotel_callout_feed_item objectHotel Callout extension.
- location_feed_item objectOutput only. Location extension. Locations are synced from a GMB account into a feed. This field is read-only.
- price_feed_item objectPrice extension.
- promotion_feed_item objectPromotion extension.
- sitelink_feed_item objectSitelink extension.
- structured_snippet_feed_item objectStructured snippet extension.
- text_message_feed_item objectText message extension.
- targeted_ad_group string
- targeted_campaign string
customers/{customer_id}/extensionFeedItems/{feed_item_id}// Example ExtensionFeedItem
const extension_feed_item = {
ad_schedules: [],
call_feed_item: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_state: 4,
call_conversion_tracking_disabled: false,
call_tracking_enabled: true,
country_code: 'GB',
phone_number: '02035751125',
},
device: 0,
extension_type: 4,
id: 13882206517,
resource_name: 'customers/3827277046/extensionFeedItems/13882206517',
status: 2,
}Get a ExtensionFeedItem
The customer.extensionFeedItems.get(resource_name) method returns the ExtensionFeedItem identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that ExtensionFeedItem
Returns
Returns that ExtensionFeedItem as an object.
// Getting the entity
let result = await customer.extensionFeedItems.get('customers/3827277046/extensionFeedItems/13882206517')// Example result
;({
ad_schedules: [],
call_feed_item: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_state: 4,
call_conversion_tracking_disabled: false,
call_tracking_enabled: true,
country_code: 'GB',
phone_number: '02035751125',
},
device: 0,
extension_type: 4,
id: 13882206517,
resource_name: 'customers/3827277046/extensionFeedItems/13882206517',
status: 2,
})List every instance of ExtensionFeedItem
The customer.extensionFeedItems.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of ExtensionFeedItem.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a extension_feed_item property. Any other resources that can be selected with extension_feed_item will also be added as properities.
// Listing all the extensionFeedItems in the account
let result = await customer.extensionFeedItems.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.extensionFeedItems.list({
constraints: [
{
key: 'extension_feed_item.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'extension_feed_item.some_field.sub_field',
})// Example result
;[
{
extension_feed_item: {
ad_schedules: [],
call_feed_item: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_state: 4,
call_conversion_tracking_disabled: false,
call_tracking_enabled: true,
country_code: 'GB',
phone_number: '02035751125',
},
device: 0,
extension_type: 4,
id: 13882206517,
resource_name: 'customers/3827277046/extensionFeedItems/13882206517',
status: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/37706041345',
campaign: 'customers/3827277046/campaigns/729684361',
cpc_bid_micros: 4770000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 37706041345,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/37706041345',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 4,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/729684361',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/1005523652',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 729684361,
labels: [],
manual_cpc: { enhanced_cpc_enabled: false },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/729684361',
serving_status: 2,
start_date: '2017-01-04',
status: 4,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: false }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a ExtensionFeedItem
The customer.extensionFeedItems.create(extension_feed_item) method makes a new ExtensionFeedItem in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The ExtensionFeedItem object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const extension_feed_item = {
// Your ExtensionFeedItem here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.extensionFeedItems.create(extension_feed_item)
// Passing in an array of entities to create, validating only
const result = await customer.extensionFeedItems.create([extension_feed_item, other_extension_feed_item], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/extensionFeedItems/13882206517'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a ExtensionFeedItem
The customer.extensionFeedItems.update(extension_feed_item) method changes the attributes of an existing extensionFeedItems in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The ExtensionFeedItem object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const extension_feed_item = {
resource_name: 'customers/3827277046/extensionFeedItems/13882206517', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.extensionFeedItems.update(extension_feed_item)
// Passing in an array of entities to update, validating only
const result = await customer.extensionFeedItems.update([extension_feed_item, other_extension_feed_item], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/extensionFeedItems/13882206517'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a ExtensionFeedItem
The customer.extensionFeedItems.delete(resource_name) sets the status field of a ExtensionFeedItem to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that ExtensionFeedItem
Returns
Nothing
// Deleting the entity
await customer.extensionFeedItems.delete('customers/3827277046/extensionFeedItems/13882206517')Feed
The Feed object
Fields
- affiliate_location_feed_data objectData used to configure an affiliate location feed populated with the specified chains.
- places_location_feed_data objectData used to configure a location feed populated from Google My Business Locations.
customers/{customer_id}/feeds/{feed_id}// Example Feed
const feed = {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
}Get a Feed
The customer.feeds.get(resource_name) method returns the Feed identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Feed
Returns
Returns that Feed as an object.
// Getting the entity
let result = await customer.feeds.get('customers/9262111890/feeds/82896692')// Example result
;({
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
})List every instance of Feed
The customer.feeds.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Feed.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a feed property. Any other resources that can be selected with feed will also be added as properities.
// Listing all the feeds in the account
let result = await customer.feeds.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.feeds.list({
constraints: [
{
key: 'feed.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'feed.some_field.sub_field',
})// Example result
;[
{
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a Feed
The customer.feeds.create(feed) method makes a new Feed in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Feed object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const feed = {
// Your Feed here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.feeds.create(feed)
// Passing in an array of entities to create, validating only
const result = await customer.feeds.create([feed, other_feed], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/feeds/82896692'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a Feed
The customer.feeds.update(feed) method changes the attributes of an existing feeds in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Feed object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const feed = {
resource_name: 'customers/9262111890/feeds/82896692', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.feeds.update(feed)
// Passing in an array of entities to update, validating only
const result = await customer.feeds.update([feed, other_feed], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/feeds/82896692'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a Feed
The customer.feeds.delete(resource_name) sets the status field of a Feed to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that Feed
Returns
Nothing
// Deleting the entity
await customer.feeds.delete('customers/9262111890/feeds/82896692')FeedItem
The FeedItem object
Fields
customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}tracking_url_template, final_urls, or mobile_final_urls.// Example FeedItem
const feed_item = {
attribute_values: [
{
feed_attribute_id: 1,
string_value: 'AdWords Knowledge Base',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 3,
string_value: 'Adwords Guides, Case Studies',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 4,
string_value: 'Chrome Extensions and more!',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 5,
integer_values_list: [],
boolean_values_list: [],
string_values_list: ['https://opteo.com/docs'],
double_values_list: [],
},
],
feed: 'customers/3827277046/feeds/43009393',
geo_targeting_restriction: 0,
id: 9779152283,
policy_infos: [
{
placeholder_type_enum: 2,
feed_mapping_resource_name: 'customers/3827277046/feedMappings/43009393~46066123',
review_status: 3,
approval_status: 2,
policy_topic_entries_list: [{ topic: 'DESTINATION_MISMATCH', type: 2, evidences_list: [], constraints_list: [] }],
validation_status: 4,
validation_errors_list: [],
quality_approval_status: 0,
quality_disapproval_reasons_list: [],
},
],
resource_name: 'customers/3827277046/feedItems/43009393~9779152283',
status: 3,
url_custom_parameters: [],
}Get a FeedItem
The customer.feedItems.get(resource_name) method returns the FeedItem identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that FeedItem
Returns
Returns that FeedItem as an object.
// Getting the entity
let result = await customer.feedItems.get('customers/3827277046/feedItems/43009393~9779152283')// Example result
;({
attribute_values: [
{
feed_attribute_id: 1,
string_value: 'AdWords Knowledge Base',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 3,
string_value: 'Adwords Guides, Case Studies',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 4,
string_value: 'Chrome Extensions and more!',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 5,
integer_values_list: [],
boolean_values_list: [],
string_values_list: ['https://opteo.com/docs'],
double_values_list: [],
},
],
feed: 'customers/3827277046/feeds/43009393',
geo_targeting_restriction: 0,
id: 9779152283,
policy_infos: [
{
placeholder_type_enum: 2,
feed_mapping_resource_name: 'customers/3827277046/feedMappings/43009393~46066123',
review_status: 3,
approval_status: 2,
policy_topic_entries_list: [{ topic: 'DESTINATION_MISMATCH', type: 2, evidences_list: [], constraints_list: [] }],
validation_status: 4,
validation_errors_list: [],
quality_approval_status: 0,
quality_disapproval_reasons_list: [],
},
],
resource_name: 'customers/3827277046/feedItems/43009393~9779152283',
status: 3,
url_custom_parameters: [],
})List every instance of FeedItem
The customer.feedItems.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of FeedItem.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a feed_item property. Any other resources that can be selected with feed_item will also be added as properities.
// Listing all the feedItems in the account
let result = await customer.feedItems.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.feedItems.list({
constraints: [
{
key: 'feed_item.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'feed_item.some_field.sub_field',
})// Example result
;[
{
feed_item: {
attribute_values: [
{
feed_attribute_id: 1,
string_value: 'AdWords Knowledge Base',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 3,
string_value: 'Adwords Guides, Case Studies',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 4,
string_value: 'Chrome Extensions and more!',
integer_values_list: [],
boolean_values_list: [],
string_values_list: [],
double_values_list: [],
},
{
feed_attribute_id: 5,
integer_values_list: [],
boolean_values_list: [],
string_values_list: ['https://opteo.com/docs'],
double_values_list: [],
},
],
feed: 'customers/3827277046/feeds/43009393',
geo_targeting_restriction: 0,
id: 9779152283,
policy_infos: [
{
placeholder_type_enum: 2,
feed_mapping_resource_name: 'customers/3827277046/feedMappings/43009393~46066123',
review_status: 3,
approval_status: 2,
policy_topic_entries_list: [
{ topic: 'DESTINATION_MISMATCH', type: 2, evidences_list: [], constraints_list: [] },
],
validation_status: 4,
validation_errors_list: [],
quality_approval_status: 0,
quality_disapproval_reasons_list: [],
},
],
resource_name: 'customers/3827277046/feedItems/43009393~9779152283',
status: 3,
url_custom_parameters: [],
},
ad_group_ad: {
ad: {
added_by_google_ads: false,
device_preference: 0,
expanded_text_ad: {
description: 'Top Rated AdWords PPC Tool. Designed For Agencies. Try It Free!',
headline_part1: 'Top Rated Google Ad Tool',
headline_part2: 'Lift PPC Results In 30 Seconds',
path1: 'google-ad',
path2: 'tool',
},
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['http://lp3.opteo.com/lp/google-ad-tool'],
id: 170067910717,
resource_name: 'customers/3827277046/ads/170067910717',
system_managed_resource_source: 0,
type: 3,
url_collections: [],
url_custom_parameters: [],
},
ad_group: 'customers/3827277046/adGroups/36337682617',
ad_strength: 0,
policy_summary: {
approval_status: 3,
policy_topic_entries: [
{
topic: 'TRADEMARKS_IN_AD_TEXT',
type: 4,
evidences_list: [{ text_list: { texts: ['Google'] } }],
constraints_list: [
{
country_constraint_list: {
total_targeted_countries: 23,
countries: [
{ country_criterion: 'geoTargetConstants/2528' },
{ country_criterion: 'geoTargetConstants/2040' },
{ country_criterion: 'geoTargetConstants/2710' },
{ country_criterion: 'geoTargetConstants/2702' },
{ country_criterion: 'geoTargetConstants/2246' },
{ country_criterion: 'geoTargetConstants/2380' },
{ country_criterion: 'geoTargetConstants/2056' },
{ country_criterion: 'geoTargetConstants/2344' },
{ country_criterion: 'geoTargetConstants/2250' },
{ country_criterion: 'geoTargetConstants/2442' },
{ country_criterion: 'geoTargetConstants/2752' },
{ country_criterion: 'geoTargetConstants/2724' },
{ country_criterion: 'geoTargetConstants/2756' },
{ country_criterion: 'geoTargetConstants/2276' },
{ country_criterion: 'geoTargetConstants/2348' },
{ country_criterion: 'geoTargetConstants/2578' },
{ country_criterion: 'geoTargetConstants/2203' },
],
},
},
],
},
],
review_status: 3,
},
resource_name: 'customers/3827277046/adGroupAds/36337682617~170067910717',
status: 2,
},
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 43009393,
name: 'My feed',
origin: 3,
resource_name: 'customers/3827277046/feeds/43009393',
status: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/36337682617',
campaign: 'customers/3827277046/campaigns/729468367',
cpc_bid_micros: 5000000,
cpm_bid_micros: 10000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 36337682617,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/36337682617',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 4,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/729468367',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/1005586771',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 4, positive_geo_target_type: 7 },
id: 729468367,
labels: [],
manual_cpc: { enhanced_cpc_enabled: true },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: true,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/729468367',
serving_status: 2,
start_date: '2017-01-04',
status: 4,
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a FeedItem
The customer.feedItems.create(feed_item) method makes a new FeedItem in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The FeedItem object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const feed_item = {
// Your FeedItem here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.feedItems.create(feed_item)
// Passing in an array of entities to create, validating only
const result = await customer.feedItems.create([feed_item, other_feed_item], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/feedItems/43009393~9779152283'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a FeedItem
The customer.feedItems.update(feed_item) method changes the attributes of an existing feedItems in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The FeedItem object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const feed_item = {
resource_name: 'customers/3827277046/feedItems/43009393~9779152283', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.feedItems.update(feed_item)
// Passing in an array of entities to update, validating only
const result = await customer.feedItems.update([feed_item, other_feed_item], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/feedItems/43009393~9779152283'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a FeedItem
The customer.feedItems.delete(resource_name) sets the status field of a FeedItem to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that FeedItem
Returns
Nothing
// Deleting the entity
await customer.feedItems.delete('customers/3827277046/feedItems/43009393~9779152283')FeedItemTarget
The FeedItemTarget object
Fields
- ad_group string
- ad_schedule objectImmutable. The targeted schedule.
- campaign string
- device enum
- geo_target_constant string
- keyword objectImmutable. The targeted keyword.
customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}// Example FeedItemTarget
const feed_item_target = /* Todo: add example get() return here */Get a FeedItemTarget
The customer.feedItemTargets.get(resource_name) method returns the FeedItemTarget identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that FeedItemTarget
Returns
Returns that FeedItemTarget as an object.
// Getting the entity
let result = await customer.feedItemTargets.get('customers/1234567890/feedItemTargets/123123123')// Example result
(/* Todo: add example get() return here */)List every instance of FeedItemTarget
The customer.feedItemTargets.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of FeedItemTarget.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a feed_item_target property. Any other resources that can be selected with feed_item_target will also be added as properities.
// Listing all the feedItemTargets in the account
let result = await customer.feedItemTargets.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.feedItemTargets.list({
constraints: [
{
key: 'feed_item_target.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'feed_item_target.some_field.sub_field',
})// Example result
;[
/* Todo: add example list() return here */
]Create a FeedItemTarget
The customer.feedItemTargets.create(feed_item_target) method makes a new FeedItemTarget in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The FeedItemTarget object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const feed_item_target = {
// Your FeedItemTarget here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.feedItemTargets.create(feed_item_target)
// Passing in an array of entities to create, validating only
const result = await customer.feedItemTargets.create([feed_item_target, other_feed_item_target], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/feedItemTargets/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a FeedItemTarget
The customer.feedItemTargets.update(feed_item_target) method changes the attributes of an existing feedItemTargets in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The FeedItemTarget object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const feed_item_target = {
resource_name: 'customers/1234567890/feedItemTargets/123123123', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.feedItemTargets.update(feed_item_target)
// Passing in an array of entities to update, validating only
const result = await customer.feedItemTargets.update([feed_item_target, other_feed_item_target], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/feedItemTargets/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a FeedItemTarget
The customer.feedItemTargets.delete(resource_name) sets the status field of a FeedItemTarget to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that FeedItemTarget
Returns
Nothing
// Deleting the entity
await customer.feedItemTargets.delete('customers/1234567890/feedItemTargets/123123123')FeedMapping
The FeedMapping object
Fields
- criterion_type enum
- placeholder_type enum
customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}// Example FeedMapping
const feed_mapping = {
attribute_field_mappings: [
{
feed_attribute_id: 1,
field_id: 1,
sitelink_field: 2,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 2,
field_id: 2,
sitelink_field: 1,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 3,
field_id: 3,
sitelink_field: 3,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 4,
field_id: 4,
sitelink_field: 4,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 5,
field_id: 5,
sitelink_field: 5,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 6,
field_id: 6,
sitelink_field: 6,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 7,
field_id: 7,
sitelink_field: 7,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 8,
field_id: 8,
sitelink_field: 8,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
],
criterion_type: 0,
feed: 'customers/9262111890/feeds/82896692',
placeholder_type: 2,
resource_name: 'customers/9262111890/feedMappings/82896692~91300060',
status: 2,
}Get a FeedMapping
The customer.feedMappings.get(resource_name) method returns the FeedMapping identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that FeedMapping
Returns
Returns that FeedMapping as an object.
// Getting the entity
let result = await customer.feedMappings.get('customers/9262111890/feedMappings/82896692~91300060')// Example result
;({
attribute_field_mappings: [
{
feed_attribute_id: 1,
field_id: 1,
sitelink_field: 2,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 2,
field_id: 2,
sitelink_field: 1,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 3,
field_id: 3,
sitelink_field: 3,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 4,
field_id: 4,
sitelink_field: 4,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 5,
field_id: 5,
sitelink_field: 5,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 6,
field_id: 6,
sitelink_field: 6,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 7,
field_id: 7,
sitelink_field: 7,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 8,
field_id: 8,
sitelink_field: 8,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
],
criterion_type: 0,
feed: 'customers/9262111890/feeds/82896692',
placeholder_type: 2,
resource_name: 'customers/9262111890/feedMappings/82896692~91300060',
status: 2,
})List every instance of FeedMapping
The customer.feedMappings.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of FeedMapping.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a feed_mapping property. Any other resources that can be selected with feed_mapping will also be added as properities.
// Listing all the feedMappings in the account
let result = await customer.feedMappings.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.feedMappings.list({
constraints: [
{
key: 'feed_mapping.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'feed_mapping.some_field.sub_field',
})// Example result
;[
{
feed_mapping: {
attribute_field_mappings: [
{
feed_attribute_id: 1,
field_id: 1,
sitelink_field: 2,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 2,
field_id: 2,
sitelink_field: 1,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 3,
field_id: 3,
sitelink_field: 3,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 4,
field_id: 4,
sitelink_field: 4,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 5,
field_id: 5,
sitelink_field: 5,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 6,
field_id: 6,
sitelink_field: 6,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 7,
field_id: 7,
sitelink_field: 7,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
{
feed_attribute_id: 8,
field_id: 8,
sitelink_field: 8,
call_field: 0,
app_field: 0,
location_field: 0,
affiliate_location_field: 0,
callout_field: 0,
structured_snippet_field: 0,
message_field: 0,
price_field: 0,
promotion_field: 0,
ad_customizer_field: 0,
dsa_page_feed_field: 0,
location_extension_targeting_field: 0,
education_field: 0,
flight_field: 0,
custom_field: 0,
hotel_field: 0,
real_estate_field: 0,
travel_field: 0,
local_field: 0,
job_field: 0,
},
],
criterion_type: 0,
feed: 'customers/9262111890/feeds/82896692',
placeholder_type: 2,
resource_name: 'customers/9262111890/feedMappings/82896692~91300060',
status: 2,
},
feed: {
attributes: [
{ id: 1, name: 'SitelinkName', type: 4, is_part_of_key: false },
{ id: 2, name: 'SitelinkUrl', type: 6, is_part_of_key: false },
{ id: 3, name: 'SitelinkDescription1', type: 4, is_part_of_key: false },
{ id: 4, name: 'SitelinkDescription2', type: 4, is_part_of_key: false },
{ id: 5, name: 'SitelinkFinalUrls', type: 12, is_part_of_key: false },
{ id: 6, name: 'SitelinkFinalMobileUrls', type: 12, is_part_of_key: false },
{ id: 7, name: 'SitelinkTrackingUrl', type: 6, is_part_of_key: false },
{ id: 8, name: 'SitelinkFinalUrlSuffix', type: 4, is_part_of_key: false },
],
id: 82896692,
name: 'My feed',
origin: 3,
resource_name: 'customers/9262111890/feeds/82896692',
status: 2,
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a FeedMapping
The customer.feedMappings.create(feed_mapping) method makes a new FeedMapping in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The FeedMapping object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const feed_mapping = {
// Your FeedMapping here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.feedMappings.create(feed_mapping)
// Passing in an array of entities to create, validating only
const result = await customer.feedMappings.create([feed_mapping, other_feed_mapping], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/feedMappings/82896692~91300060'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a FeedMapping
The customer.feedMappings.update(feed_mapping) method changes the attributes of an existing feedMappings in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The FeedMapping object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const feed_mapping = {
resource_name: 'customers/9262111890/feedMappings/82896692~91300060', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.feedMappings.update(feed_mapping)
// Passing in an array of entities to update, validating only
const result = await customer.feedMappings.update([feed_mapping, other_feed_mapping], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/feedMappings/82896692~91300060'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a FeedMapping
The customer.feedMappings.delete(resource_name) sets the status field of a FeedMapping to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that FeedMapping
Returns
Nothing
// Deleting the entity
await customer.feedMappings.delete('customers/9262111890/feedMappings/82896692~91300060')GeoTargetConstant
The GeoTargetConstant object
Fields
geoTargetConstants/{geo_target_constant_id}// Example GeoTargetConstant
const geo_target_constant = {
canonical_name: 'South Georgia and the South Sandwich Islands',
country_code: 'GS',
id: 2239,
name: 'South Georgia and the South Sandwich Islands',
resource_name: 'geoTargetConstants/2239',
status: 2,
target_type: 'Country',
}Get a GeoTargetConstant
The customer.geoTargetConstants.get(resource_name) method returns the GeoTargetConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that GeoTargetConstant
Returns
Returns that GeoTargetConstant as an object.
// Getting the entity
let result = await customer.geoTargetConstants.get('geoTargetConstants/2239')// Example result
;({
canonical_name: 'South Georgia and the South Sandwich Islands',
country_code: 'GS',
id: 2239,
name: 'South Georgia and the South Sandwich Islands',
resource_name: 'geoTargetConstants/2239',
status: 2,
target_type: 'Country',
})List every instance of GeoTargetConstant
The customer.geoTargetConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of GeoTargetConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a geo_target_constant property. Any other resources that can be selected with geo_target_constant will also be added as properities.
// Listing all the geoTargetConstants in the account
let result = await customer.geoTargetConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.geoTargetConstants.list({
constraints: [
{
key: 'geo_target_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'geo_target_constant.some_field.sub_field',
})// Example result
;[
{
geo_target_constant: {
canonical_name: 'South Georgia and the South Sandwich Islands',
country_code: 'GS',
id: 2239,
name: 'South Georgia and the South Sandwich Islands',
resource_name: 'geoTargetConstants/2239',
status: 2,
target_type: 'Country',
},
},
]Get GeoTargetConstant Suggestions
The customer.geoTargetConstants.suggest() method returns geo target constant suggestion.
Arguments
-
locale optional
If possible, returned geo targets are translated using this locale. If not, en is used by default. This is also used as a hint for returned geo targets.
-
country_code optional
Returned geo targets are restricted to this country code.
-
location_names optional, array/object
The location names to search by. At most 25 names can be set.
-
geo_targets optional, array/object
The geo target constant resource names to filter by.
Returns
Returns an array of objects.
Each object has locale, reach, search_term, geo_target_constant and geo_target_constant_parents[] properties.
// Get geo target constant suggestions
let result = await customer.geoTargetConstants.suggest({
locale: 'en',
country_code: 'GB',
location_names: { names: ['London'] },
})// Example result
;[
{
locale: 'en',
reach: 32000000,
search_term: 'London',
geo_target_constant: {
resource_name: 'geoTargetConstants/1006886',
id: 1006886,
name: 'London',
country_code: 'GB',
target_type: 'City',
status: 2,
canonical_name: 'London,England,United Kingdom',
},
geo_target_constant_parents_list: [
{
resource_name: 'geoTargetConstants/20339',
id: 20339,
name: 'England',
country_code: 'GB',
target_type: 'Province',
status: 2,
},
{
resource_name: 'geoTargetConstants/2826',
id: 2826,
name: 'United Kingdom',
country_code: 'GB',
target_type: 'Country',
status: 2,
},
],
},
]KeywordPlan
The KeywordPlan object
Fields
customers/{customer_id}/keywordPlans/{kp_plan_id}// Example KeywordPlan
const keyword_plan = {
forecast_period: { date_interval: 4 },
id: 115113466,
name: 'My keyword plan',
resource_name: 'customers/9262111890/keywordPlans/115113466',
}Get a KeywordPlan
The customer.keywordPlans.get(resource_name) method returns the KeywordPlan identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that KeywordPlan
Returns
Returns that KeywordPlan as an object.
// Getting the entity
let result = await customer.keywordPlans.get('customers/9262111890/keywordPlans/115113466')// Example result
;({
forecast_period: { date_interval: 4 },
id: 115113466,
name: 'My keyword plan',
resource_name: 'customers/9262111890/keywordPlans/115113466',
})List every instance of KeywordPlan
The customer.keywordPlans.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of KeywordPlan.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a keyword_plan property. Any other resources that can be selected with keyword_plan will also be added as properities.
// Listing all the keywordPlans in the account
let result = await customer.keywordPlans.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.keywordPlans.list({
constraints: [
{
key: 'keyword_plan.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'keyword_plan.some_field.sub_field',
})// Example result
;[
{
keyword_plan: {
forecast_period: { date_interval: 4 },
id: 115113466,
name: 'My keyword plan',
resource_name: 'customers/9262111890/keywordPlans/115113466',
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a KeywordPlan
The customer.keywordPlans.create(keyword_plan) method makes a new KeywordPlan in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlan object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const keyword_plan = {
// Your KeywordPlan here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.keywordPlans.create(keyword_plan)
// Passing in an array of entities to create, validating only
const result = await customer.keywordPlans.create([keyword_plan, other_keyword_plan], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/keywordPlans/115113466'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a KeywordPlan
The customer.keywordPlans.update(keyword_plan) method changes the attributes of an existing keywordPlans in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlan object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const keyword_plan = {
resource_name: 'customers/9262111890/keywordPlans/115113466', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.keywordPlans.update(keyword_plan)
// Passing in an array of entities to update, validating only
const result = await customer.keywordPlans.update([keyword_plan, other_keyword_plan], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/keywordPlans/115113466'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a KeywordPlan
The customer.keywordPlans.delete(resource_name) sets the status field of a KeywordPlan to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that KeywordPlan
Returns
Nothing
// Deleting the entity
await customer.keywordPlans.delete('customers/9262111890/keywordPlans/115113466')KeywordPlanAdGroup
The KeywordPlanAdGroup object
Fields
customers/{customer_id}/keywordPlanAdGroups/{kp_ad_group_id}// Example KeywordPlanAdGroup
const keyword_plan_ad_group = {
cpc_bid_micros: 2500000,
id: 104819196,
keyword_plan_campaign: 'customers/9262111890/keywordPlanCampaigns/115088623',
name: 'My keyword plan ad group',
resource_name: 'customers/9262111890/keywordPlanAdGroups/104819196',
}Get a KeywordPlanAdGroup
The customer.keywordPlanAdGroups.get(resource_name) method returns the KeywordPlanAdGroup identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that KeywordPlanAdGroup
Returns
Returns that KeywordPlanAdGroup as an object.
// Getting the entity
let result = await customer.keywordPlanAdGroups.get('customers/9262111890/keywordPlanAdGroups/104819196')// Example result
;({
cpc_bid_micros: 2500000,
id: 104819196,
keyword_plan_campaign: 'customers/9262111890/keywordPlanCampaigns/115088623',
name: 'My keyword plan ad group',
resource_name: 'customers/9262111890/keywordPlanAdGroups/104819196',
})List every instance of KeywordPlanAdGroup
The customer.keywordPlanAdGroups.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of KeywordPlanAdGroup.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a keyword_plan_ad_group property. Any other resources that can be selected with keyword_plan_ad_group will also be added as properities.
// Listing all the keywordPlanAdGroups in the account
let result = await customer.keywordPlanAdGroups.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.keywordPlanAdGroups.list({
constraints: [
{
key: 'keyword_plan_ad_group.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'keyword_plan_ad_group.some_field.sub_field',
})// Example result
;[
{
keyword_plan_ad_group: {
cpc_bid_micros: 2500000,
id: 104819196,
keyword_plan_campaign: 'customers/9262111890/keywordPlanCampaigns/115088623',
name: 'My keyword plan ad group',
resource_name: 'customers/9262111890/keywordPlanAdGroups/104819196',
},
keyword_plan: {
forecast_period: { date_interval: 4 },
id: 115133472,
name: 'My keyword plan',
resource_name: 'customers/9262111890/keywordPlans/115133472',
},
keyword_plan_campaign: {
cpc_bid_micros: 1000000,
geo_targets: [{ geo_target_constant: 'geoTargetConstants/1021278' }],
id: 115088623,
keyword_plan: 'customers/9262111890/keywordPlans/115133472',
keyword_plan_network: 2,
language_constants: ['languageConstants/1000'],
name: 'My keyword plan campaign',
resource_name: 'customers/9262111890/keywordPlanCampaigns/115088623',
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a KeywordPlanAdGroup
The customer.keywordPlanAdGroups.create(keyword_plan_ad_group) method makes a new KeywordPlanAdGroup in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanAdGroup object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const keyword_plan_ad_group = {
// Your KeywordPlanAdGroup here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.keywordPlanAdGroups.create(keyword_plan_ad_group)
// Passing in an array of entities to create, validating only
const result = await customer.keywordPlanAdGroups.create([keyword_plan_ad_group, other_keyword_plan_ad_group], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/keywordPlanAdGroups/104819196'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a KeywordPlanAdGroup
The customer.keywordPlanAdGroups.update(keyword_plan_ad_group) method changes the attributes of an existing keywordPlanAdGroups in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanAdGroup object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const keyword_plan_ad_group = {
resource_name: 'customers/9262111890/keywordPlanAdGroups/104819196', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.keywordPlanAdGroups.update(keyword_plan_ad_group)
// Passing in an array of entities to update, validating only
const result = await customer.keywordPlanAdGroups.update([keyword_plan_ad_group, other_keyword_plan_ad_group], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/keywordPlanAdGroups/104819196'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a KeywordPlanAdGroup
The customer.keywordPlanAdGroups.delete(resource_name) sets the status field of a KeywordPlanAdGroup to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that KeywordPlanAdGroup
Returns
Nothing
// Deleting the entity
await customer.keywordPlanAdGroups.delete('customers/9262111890/keywordPlanAdGroups/104819196')KeywordPlanCampaign
The KeywordPlanCampaign object
Fields
customers/{customer_id}/keywordPlanCampaigns/{kp_campaign_id}// Example KeywordPlanCampaign
const keyword_plan_campaign = {
cpc_bid_micros: 1000000,
geo_targets: [{ geo_target_constant: 'geoTargetConstants/1021278' }],
id: 115088623,
keyword_plan: 'customers/9262111890/keywordPlans/115133472',
keyword_plan_network: 2,
language_constants: ['languageConstants/1000'],
name: 'My keyword plan campaign',
resource_name: 'customers/9262111890/keywordPlanCampaigns/115088623',
}Get a KeywordPlanCampaign
The customer.keywordPlanCampaigns.get(resource_name) method returns the KeywordPlanCampaign identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that KeywordPlanCampaign
Returns
Returns that KeywordPlanCampaign as an object.
// Getting the entity
let result = await customer.keywordPlanCampaigns.get('customers/9262111890/keywordPlanCampaigns/115088623')// Example result
;({
cpc_bid_micros: 1000000,
geo_targets: [{ geo_target_constant: 'geoTargetConstants/1021278' }],
id: 115088623,
keyword_plan: 'customers/9262111890/keywordPlans/115133472',
keyword_plan_network: 2,
language_constants: ['languageConstants/1000'],
name: 'My keyword plan campaign',
resource_name: 'customers/9262111890/keywordPlanCampaigns/115088623',
})List every instance of KeywordPlanCampaign
The customer.keywordPlanCampaigns.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of KeywordPlanCampaign.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a keyword_plan_campaign property. Any other resources that can be selected with keyword_plan_campaign will also be added as properities.
// Listing all the keywordPlanCampaigns in the account
let result = await customer.keywordPlanCampaigns.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.keywordPlanCampaigns.list({
constraints: [
{
key: 'keyword_plan_campaign.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'keyword_plan_campaign.some_field.sub_field',
})// Example result
;[
{
keyword_plan_campaign: {
cpc_bid_micros: 1000000,
geo_targets: [{ geo_target_constant: 'geoTargetConstants/1021278' }],
id: 115088623,
keyword_plan: 'customers/9262111890/keywordPlans/115133472',
keyword_plan_network: 2,
language_constants: ['languageConstants/1000'],
name: 'My keyword plan campaign',
resource_name: 'customers/9262111890/keywordPlanCampaigns/115088623',
},
keyword_plan: {
forecast_period: { date_interval: 4 },
id: 115133472,
name: 'My keyword plan',
resource_name: 'customers/9262111890/keywordPlans/115133472',
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a KeywordPlanCampaign
The customer.keywordPlanCampaigns.create(keyword_plan_campaign) method makes a new KeywordPlanCampaign in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanCampaign object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const keyword_plan_campaign = {
// Your KeywordPlanCampaign here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.keywordPlanCampaigns.create(keyword_plan_campaign)
// Passing in an array of entities to create, validating only
const result = await customer.keywordPlanCampaigns.create([keyword_plan_campaign, other_keyword_plan_campaign], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/keywordPlanCampaigns/115088623'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a KeywordPlanCampaign
The customer.keywordPlanCampaigns.update(keyword_plan_campaign) method changes the attributes of an existing keywordPlanCampaigns in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanCampaign object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const keyword_plan_campaign = {
resource_name: 'customers/9262111890/keywordPlanCampaigns/115088623', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.keywordPlanCampaigns.update(keyword_plan_campaign)
// Passing in an array of entities to update, validating only
const result = await customer.keywordPlanCampaigns.update([keyword_plan_campaign, other_keyword_plan_campaign], {
validate_only: true,
})// Example result
{
results : ['customers/9262111890/keywordPlanCampaigns/115088623'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a KeywordPlanCampaign
The customer.keywordPlanCampaigns.delete(resource_name) sets the status field of a KeywordPlanCampaign to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that KeywordPlanCampaign
Returns
Nothing
// Deleting the entity
await customer.keywordPlanCampaigns.delete('customers/9262111890/keywordPlanCampaigns/115088623')KeywordPlanKeyword
The KeywordPlanKeyword object
Fields
customers/{customer_id}/keywordPlanKeywords/{kp_ad_group_keyword_id}// Example KeywordPlanKeyword
const keyword_plan_keyword = /* Todo: add example get() return here */Get a KeywordPlanKeyword
The customer.keywordPlanKeywords.get(resource_name) method returns the KeywordPlanKeyword identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that KeywordPlanKeyword
Returns
Returns that KeywordPlanKeyword as an object.
// Getting the entity
let result = await customer.keywordPlanKeywords.get('customers/1234567890/keywordPlanKeywords/123123123')// Example result
(/* Todo: add example get() return here */)List every instance of KeywordPlanKeyword
The customer.keywordPlanKeywords.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of KeywordPlanKeyword.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a keyword_plan_keyword property. Any other resources that can be selected with keyword_plan_keyword will also be added as properities.
// Listing all the keywordPlanKeywords in the account
let result = await customer.keywordPlanKeywords.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.keywordPlanKeywords.list({
constraints: [
{
key: 'keyword_plan_keyword.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'keyword_plan_keyword.some_field.sub_field',
})// Example result
;[
/* Todo: add example list() return here */
]Create a KeywordPlanKeyword
The customer.keywordPlanKeywords.create(keyword_plan_keyword) method makes a new KeywordPlanKeyword in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanKeyword object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const keyword_plan_keyword = {
// Your KeywordPlanKeyword here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.keywordPlanKeywords.create(keyword_plan_keyword)
// Passing in an array of entities to create, validating only
const result = await customer.keywordPlanKeywords.create([keyword_plan_keyword, other_keyword_plan_keyword], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/keywordPlanKeywords/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a KeywordPlanKeyword
The customer.keywordPlanKeywords.update(keyword_plan_keyword) method changes the attributes of an existing keywordPlanKeywords in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanKeyword object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const keyword_plan_keyword = {
resource_name: 'customers/1234567890/keywordPlanKeywords/123123123', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.keywordPlanKeywords.update(keyword_plan_keyword)
// Passing in an array of entities to update, validating only
const result = await customer.keywordPlanKeywords.update([keyword_plan_keyword, other_keyword_plan_keyword], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/keywordPlanKeywords/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a KeywordPlanKeyword
The customer.keywordPlanKeywords.delete(resource_name) sets the status field of a KeywordPlanKeyword to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that KeywordPlanKeyword
Returns
Nothing
// Deleting the entity
await customer.keywordPlanKeywords.delete('customers/1234567890/keywordPlanKeywords/123123123')KeywordPlanNegativeKeyword
The KeywordPlanNegativeKeyword object
Fields
customers/{customer_id}/keywordPlanNegativeKeywords/{kp_negative_keyword_id}// Example KeywordPlanNegativeKeyword
const keyword_plan_negative_keyword = {
id: 13119148,
keyword_plan_campaign: 'customers/9262111890/keywordPlanCampaigns/115088623',
match_type: 4,
resource_name: 'customers/9262111890/keywordPlanNegativeKeywords/13119148',
text: 'moon walk',
}Get a KeywordPlanNegativeKeyword
The customer.keywordPlanNegativeKeywords.get(resource_name) method returns the KeywordPlanNegativeKeyword identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that KeywordPlanNegativeKeyword
Returns
Returns that KeywordPlanNegativeKeyword as an object.
// Getting the entity
let result = await customer.keywordPlanNegativeKeywords.get('customers/9262111890/keywordPlanNegativeKeywords/13119148')// Example result
;({
id: 13119148,
keyword_plan_campaign: 'customers/9262111890/keywordPlanCampaigns/115088623',
match_type: 4,
resource_name: 'customers/9262111890/keywordPlanNegativeKeywords/13119148',
text: 'moon walk',
})List every instance of KeywordPlanNegativeKeyword
The customer.keywordPlanNegativeKeywords.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of KeywordPlanNegativeKeyword.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a keyword_plan_negative_keyword property. Any other resources that can be selected with keyword_plan_negative_keyword will also be added as properities.
// Listing all the keywordPlanNegativeKeywords in the account
let result = await customer.keywordPlanNegativeKeywords.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.keywordPlanNegativeKeywords.list({
constraints: [
{
key: 'keyword_plan_negative_keyword.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'keyword_plan_negative_keyword.some_field.sub_field',
})// Example result
;[
{
keyword_plan_negative_keyword: {
id: 13119148,
keyword_plan_campaign: 'customers/9262111890/keywordPlanCampaigns/115088623',
match_type: 4,
resource_name: 'customers/9262111890/keywordPlanNegativeKeywords/13119148',
text: 'moon walk',
},
keyword_plan: {
forecast_period: { date_interval: 4 },
id: 115133472,
name: 'My keyword plan',
resource_name: 'customers/9262111890/keywordPlans/115133472',
},
keyword_plan_campaign: {
cpc_bid_micros: 1000000,
geo_targets: [{ geo_target_constant: 'geoTargetConstants/1021278' }],
id: 115088623,
keyword_plan: 'customers/9262111890/keywordPlans/115133472',
keyword_plan_network: 2,
language_constants: ['languageConstants/1000'],
name: 'My keyword plan campaign',
resource_name: 'customers/9262111890/keywordPlanCampaigns/115088623',
},
customer: {
auto_tagging_enabled: false,
call_reporting_setting: {
call_conversion_action: 'customers/9262111890/conversionActions/179',
call_conversion_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 797556569 },
currency_code: 'EUR',
descriptive_name: 'My customer',
has_partners_badge: false,
id: 9262111890,
manager: false,
pay_per_conversion_eligibility_failure_reasons: [8, 2],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 797556569 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-797556569\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-797556569');\n</script>\n",
},
resource_name: 'customers/9262111890',
test_account: true,
time_zone: 'Europe/London',
},
},
]Create a KeywordPlanNegativeKeyword
The customer.keywordPlanNegativeKeywords.create(keyword_plan_negative_keyword) method makes a new KeywordPlanNegativeKeyword in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanNegativeKeyword object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const keyword_plan_negative_keyword = {
// Your KeywordPlanNegativeKeyword here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.keywordPlanNegativeKeywords.create(keyword_plan_negative_keyword)
// Passing in an array of entities to create, validating only
const result = await customer.keywordPlanNegativeKeywords.create(
[keyword_plan_negative_keyword, other_keyword_plan_negative_keyword],
{
validate_only: true,
}
)// Example result
{
results : ['customers/9262111890/keywordPlanNegativeKeywords/13119148'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a KeywordPlanNegativeKeyword
The customer.keywordPlanNegativeKeywords.update(keyword_plan_negative_keyword) method changes the attributes of an existing keywordPlanNegativeKeywords in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The KeywordPlanNegativeKeyword object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const keyword_plan_negative_keyword = {
resource_name: 'customers/9262111890/keywordPlanNegativeKeywords/13119148', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.keywordPlanNegativeKeywords.update(keyword_plan_negative_keyword)
// Passing in an array of entities to update, validating only
const result = await customer.keywordPlanNegativeKeywords.update(
[keyword_plan_negative_keyword, other_keyword_plan_negative_keyword],
{
validate_only: true,
}
)// Example result
{
results : ['customers/9262111890/keywordPlanNegativeKeywords/13119148'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a KeywordPlanNegativeKeyword
The customer.keywordPlanNegativeKeywords.delete(resource_name) sets the status field of a KeywordPlanNegativeKeyword to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that KeywordPlanNegativeKeyword
Returns
Nothing
// Deleting the entity
await customer.keywordPlanNegativeKeywords.delete('customers/9262111890/keywordPlanNegativeKeywords/13119148')Label
The Label object
Fields
customers/{customer_id}/labels/{label_id}// Example Label
const label = {
id: 3345231412,
name: 'My label',
resource_name: 'customers/3827277046/labels/3345231412',
status: 2,
text_label: { background_color: '#e993eb', description: 'Adgroups where Chloe will write new ads that kick butt.' },
}Get a Label
The customer.labels.get(resource_name) method returns the Label identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Label
Returns
Returns that Label as an object.
// Getting the entity
let result = await customer.labels.get('customers/3827277046/labels/3345231412')// Example result
;({
id: 3345231412,
name: 'My label',
resource_name: 'customers/3827277046/labels/3345231412',
status: 2,
text_label: { background_color: '#e993eb', description: 'Adgroups where Chloe will write new ads that kick butt.' },
})List every instance of Label
The customer.labels.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Label.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a label property. Any other resources that can be selected with label will also be added as properities.
// Listing all the labels in the account
let result = await customer.labels.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.labels.list({
constraints: [
{
key: 'label.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'label.some_field.sub_field',
})// Example result
;[
{
label: {
id: 3345231412,
name: 'My label',
resource_name: 'customers/3827277046/labels/3345231412',
status: 2,
text_label: {
background_color: '#e993eb',
description: 'Adgroups where Chloe will write new ads that kick butt.',
},
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a Label
The customer.labels.create(label) method makes a new Label in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Label object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const label = {
// Your Label here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.labels.create(label)
// Passing in an array of entities to create, validating only
const result = await customer.labels.create([label, other_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/labels/3345231412'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a Label
The customer.labels.update(label) method changes the attributes of an existing labels in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The Label object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const label = {
resource_name: 'customers/3827277046/labels/3345231412', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.labels.update(label)
// Passing in an array of entities to update, validating only
const result = await customer.labels.update([label, other_label], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/labels/3345231412'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a Label
The customer.labels.delete(resource_name) sets the status field of a Label to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that Label
Returns
Nothing
// Deleting the entity
await customer.labels.delete('customers/3827277046/labels/3345231412')LanguageConstant
The LanguageConstant object
Fields
languageConstants/{criterion_id}// Example LanguageConstant
const language_constant = {
code: 'zh_TW',
id: 1018,
name: 'Chinese (traditional)',
resource_name: 'languageConstants/1018',
targetable: true,
}Get a LanguageConstant
The customer.languageConstants.get(resource_name) method returns the LanguageConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that LanguageConstant
Returns
Returns that LanguageConstant as an object.
// Getting the entity
let result = await customer.languageConstants.get('languageConstants/1018')// Example result
;({ code: 'zh_TW', id: 1018, name: 'Chinese (traditional)', resource_name: 'languageConstants/1018', targetable: true })List every instance of LanguageConstant
The customer.languageConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of LanguageConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a language_constant property. Any other resources that can be selected with language_constant will also be added as properities.
// Listing all the languageConstants in the account
let result = await customer.languageConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.languageConstants.list({
constraints: [
{
key: 'language_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'language_constant.some_field.sub_field',
})// Example result
;[
{
language_constant: {
code: 'zh_TW',
id: 1018,
name: 'Chinese (traditional)',
resource_name: 'languageConstants/1018',
targetable: true,
},
},
]MediaFile
The MediaFile object
Fields
- audio objectOutput only. Encapsulates an Audio.
- image objectImmutable. Encapsulates an Image.
- media_bundle objectImmutable. A ZIP archive media the content of which contains HTML5 assets.
- video objectImmutable. Encapsulates a Video.
customers/{customer_id}/mediaFiles/{media_file_id}// Example MediaFile
const media_file = {
file_size: 5159,
id: 44067075104,
mime_type: 2,
name: '',
resource_name: 'customers/3827277046/mediaFiles/44067075104',
source_url:
'https://lh3.googleusercontent.com/D3DAe038umSn2ap4q_Ll7HPSTNj5szBbJNOoXeblYkmlZHCGg1JiIq45WIr_CEGM9FXoH1vb9Hi1gF7CLw',
type: 2,
}Get a MediaFile
The customer.mediaFiles.get(resource_name) method returns the MediaFile identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that MediaFile
Returns
Returns that MediaFile as an object.
// Getting the entity
let result = await customer.mediaFiles.get('customers/3827277046/mediaFiles/44067075104')// Example result
;({
file_size: 5159,
id: 44067075104,
mime_type: 2,
name: '',
resource_name: 'customers/3827277046/mediaFiles/44067075104',
source_url:
'https://lh3.googleusercontent.com/D3DAe038umSn2ap4q_Ll7HPSTNj5szBbJNOoXeblYkmlZHCGg1JiIq45WIr_CEGM9FXoH1vb9Hi1gF7CLw',
type: 2,
})List every instance of MediaFile
The customer.mediaFiles.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of MediaFile.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a media_file property. Any other resources that can be selected with media_file will also be added as properities.
// Listing all the mediaFiles in the account
let result = await customer.mediaFiles.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.mediaFiles.list({
constraints: [
{
key: 'media_file.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'media_file.some_field.sub_field',
})// Example result
;[
{
media_file: {
file_size: 5159,
id: 44067075104,
mime_type: 2,
name: '',
resource_name: 'customers/3827277046/mediaFiles/44067075104',
source_url:
'https://lh3.googleusercontent.com/D3DAe038umSn2ap4q_Ll7HPSTNj5szBbJNOoXeblYkmlZHCGg1JiIq45WIr_CEGM9FXoH1vb9Hi1gF7CLw',
type: 2,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a MediaFile
The customer.mediaFiles.create(media_file) method makes a new MediaFile in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The MediaFile object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const media_file = {
// Your MediaFile here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.mediaFiles.create(media_file)
// Passing in an array of entities to create, validating only
const result = await customer.mediaFiles.create([media_file, other_media_file], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/mediaFiles/44067075104'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a MediaFile
The customer.mediaFiles.update(media_file) method changes the attributes of an existing mediaFiles in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The MediaFile object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const media_file = {
resource_name: 'customers/3827277046/mediaFiles/44067075104', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.mediaFiles.update(media_file)
// Passing in an array of entities to update, validating only
const result = await customer.mediaFiles.update([media_file, other_media_file], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/mediaFiles/44067075104'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a MediaFile
The customer.mediaFiles.delete(resource_name) sets the status field of a MediaFile to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that MediaFile
Returns
Nothing
// Deleting the entity
await customer.mediaFiles.delete('customers/3827277046/mediaFiles/44067075104')MobileAppCategoryConstant
The MobileAppCategoryConstant object
Fields
mobileAppCategoryConstants/{mobile_app_category_id}// Example MobileAppCategoryConstant
const mobile_app_category_constant = {
id: 60013,
name: 'Video Players & Editors',
resource_name: 'mobileAppCategoryConstants/60013',
}Get a MobileAppCategoryConstant
The customer.mobileAppCategoryConstants.get(resource_name) method returns the MobileAppCategoryConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that MobileAppCategoryConstant
Returns
Returns that MobileAppCategoryConstant as an object.
// Getting the entity
let result = await customer.mobileAppCategoryConstants.get('mobileAppCategoryConstants/60013')// Example result
;({ id: 60013, name: 'Video Players & Editors', resource_name: 'mobileAppCategoryConstants/60013' })List every instance of MobileAppCategoryConstant
The customer.mobileAppCategoryConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of MobileAppCategoryConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a mobile_app_category_constant property. Any other resources that can be selected with mobile_app_category_constant will also be added as properities.
// Listing all the mobileAppCategoryConstants in the account
let result = await customer.mobileAppCategoryConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.mobileAppCategoryConstants.list({
constraints: [
{
key: 'mobile_app_category_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'mobile_app_category_constant.some_field.sub_field',
})// Example result
;[
{
mobile_app_category_constant: {
id: 60013,
name: 'Video Players & Editors',
resource_name: 'mobileAppCategoryConstants/60013',
},
},
]MobileDeviceConstant
The MobileDeviceConstant object
Fields
mobileDeviceConstants/{criterion_id}// Example MobileDeviceConstant
const mobile_device_constant = {
id: 605309,
manufacturer_name: 'T-Mobile',
name: 'myTouch 3G Slide',
operating_system_name: 'Android',
resource_name: 'mobileDeviceConstants/605309',
type: 2,
}Get a MobileDeviceConstant
The customer.mobileDeviceConstants.get(resource_name) method returns the MobileDeviceConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that MobileDeviceConstant
Returns
Returns that MobileDeviceConstant as an object.
// Getting the entity
let result = await customer.mobileDeviceConstants.get('mobileDeviceConstants/605309')// Example result
;({
id: 605309,
manufacturer_name: 'T-Mobile',
name: 'myTouch 3G Slide',
operating_system_name: 'Android',
resource_name: 'mobileDeviceConstants/605309',
type: 2,
})List every instance of MobileDeviceConstant
The customer.mobileDeviceConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of MobileDeviceConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a mobile_device_constant property. Any other resources that can be selected with mobile_device_constant will also be added as properities.
// Listing all the mobileDeviceConstants in the account
let result = await customer.mobileDeviceConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.mobileDeviceConstants.list({
constraints: [
{
key: 'mobile_device_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'mobile_device_constant.some_field.sub_field',
})// Example result
;[
{
mobile_device_constant: {
id: 605309,
manufacturer_name: 'T-Mobile',
name: 'myTouch 3G Slide',
operating_system_name: 'Android',
resource_name: 'mobileDeviceConstants/605309',
type: 2,
},
},
]OperatingSystemVersionConstant
The OperatingSystemVersionConstant object
Fields
operatingSystemVersionConstants/{criterion_id}// Example OperatingSystemVersionConstant
const operating_system_version_constant = {
id: 630266,
name: 'WindowsPhone',
operator_type: 2,
os_major_version: -1,
os_minor_version: -1,
resource_name: 'operatingSystemVersionConstants/630266',
}Get an OperatingSystemVersionConstant
The customer.operatingSystemVersionConstants.get(resource_name) method returns the OperatingSystemVersionConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that OperatingSystemVersionConstant
Returns
Returns that OperatingSystemVersionConstant as an object.
// Getting the entity
let result = await customer.operatingSystemVersionConstants.get('operatingSystemVersionConstants/630266')// Example result
;({
id: 630266,
name: 'WindowsPhone',
operator_type: 2,
os_major_version: -1,
os_minor_version: -1,
resource_name: 'operatingSystemVersionConstants/630266',
})List every instance of OperatingSystemVersionConstant
The customer.operatingSystemVersionConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of OperatingSystemVersionConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a operating_system_version_constant property. Any other resources that can be selected with operating_system_version_constant will also be added as properities.
// Listing all the operatingSystemVersionConstants in the account
let result = await customer.operatingSystemVersionConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.operatingSystemVersionConstants.list({
constraints: [
{
key: 'operating_system_version_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'operating_system_version_constant.some_field.sub_field',
})// Example result
;[
{
operating_system_version_constant: {
id: 630266,
name: 'WindowsPhone',
operator_type: 2,
os_major_version: -1,
os_minor_version: -1,
resource_name: 'operatingSystemVersionConstants/630266',
},
},
]ProductBiddingCategoryConstant
The ProductBiddingCategoryConstant object
Fields
productBiddingCategoryConstants/{country_code}~{level}~{id}// Example ProductBiddingCategoryConstant
const product_bidding_category_constant = {
country_code: 'AU',
id: 55,
language_code: 'en',
level: 4,
localized_name: 'Musical Instrument & Orchestra Accessories',
product_bidding_category_constant_parent: 'productBiddingCategoryConstants/AU~LEVEL2~5710',
resource_name: 'productBiddingCategoryConstants/AU~LEVEL3~55',
status: 2,
}Get a ProductBiddingCategoryConstant
The customer.productBiddingCategoryConstants.get(resource_name) method returns the ProductBiddingCategoryConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that ProductBiddingCategoryConstant
Returns
Returns that ProductBiddingCategoryConstant as an object.
// Getting the entity
let result = await customer.productBiddingCategoryConstants.get('productBiddingCategoryConstants/AU~LEVEL3~55')// Example result
;({
country_code: 'AU',
id: 55,
language_code: 'en',
level: 4,
localized_name: 'Musical Instrument & Orchestra Accessories',
product_bidding_category_constant_parent: 'productBiddingCategoryConstants/AU~LEVEL2~5710',
resource_name: 'productBiddingCategoryConstants/AU~LEVEL3~55',
status: 2,
})List every instance of ProductBiddingCategoryConstant
The customer.productBiddingCategoryConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of ProductBiddingCategoryConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a product_bidding_category_constant property. Any other resources that can be selected with product_bidding_category_constant will also be added as properities.
// Listing all the productBiddingCategoryConstants in the account
let result = await customer.productBiddingCategoryConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.productBiddingCategoryConstants.list({
constraints: [
{
key: 'product_bidding_category_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'product_bidding_category_constant.some_field.sub_field',
})// Example result
;[
{
product_bidding_category_constant: {
country_code: 'AU',
id: 55,
language_code: 'en',
level: 4,
localized_name: 'Musical Instrument & Orchestra Accessories',
product_bidding_category_constant_parent: 'productBiddingCategoryConstants/AU~LEVEL2~5710',
resource_name: 'productBiddingCategoryConstants/AU~LEVEL3~55',
status: 2,
},
},
]Recommendation
The Recommendation object
Fields
- call_extension_recommendation objectOutput only. The Call extension recommendation.
- callout_extension_recommendation objectOutput only. The Callout extension recommendation.
- campaign_budget_recommendation objectOutput only. The campaign budget recommendation.
- enhanced_cpc_opt_in_recommendation objectOutput only. The Enhanced Cost-Per-Click Opt-In recommendation.
- keyword_match_type_recommendation objectOutput only. The keyword match type recommendation.
- keyword_recommendation objectOutput only. The keyword recommendation.
- maximize_clicks_opt_in_recommendation objectOutput only. The MaximizeClicks Opt-In recommendation.
- maximize_conversions_opt_in_recommendation objectOutput only. The MaximizeConversions Opt-In recommendation.
- move_unused_budget_recommendation objectOutput only. The move unused budget recommendation.
- optimize_ad_rotation_recommendation objectOutput only. The Optimize Ad Rotation recommendation.
- search_partners_opt_in_recommendation objectOutput only. The Search Partners Opt-In recommendation.
- sitelink_extension_recommendation objectOutput only. The Sitelink extension recommendation.
- target_cpa_opt_in_recommendation objectOutput only. The TargetCPA opt-in recommendation.
- text_ad_recommendation objectOutput only. Add expanded text ad recommendation.
customers/{customer_id}/recommendations/{recommendation_id}// Example Recommendation
const recommendation = {
ad_group: 'customers/3827277046/adGroups/77057363272',
campaign: 'customers/3827277046/campaigns/2081620948',
campaign_budget: 'customers/3827277046/campaignBudgets/6449346162',
dismissed: false,
impact: {
base_metrics: { clicks: 2, cost_micros: 20460000, impressions: 12 },
potential_metrics: { clicks: 4, conversions: 0.05, cost_micros: 36006832, impressions: 110 },
},
keyword_recommendation: {
keyword: { match_type: 2, text: 'google adwords management' },
recommended_cpc_bid_micros: 9600000,
},
resource_name:
'customers/3827277046/recommendations/MTk5MDY3NzIzLTE2My0xNTk1MTg1NjIwMDAwLSsyMDgxNjIwOTQ4LTc3MDU3MzYzMjcyLTIyNzkzMTg2Nzk5NTk5NTgxOTU',
type: 3,
}Get a Recommendation
The customer.recommendations.get(resource_name) method returns the Recommendation identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Recommendation
Returns
Returns that Recommendation as an object.
// Getting the entity
let result = await customer.recommendations.get(
'customers/3827277046/recommendations/MTk5MDY3NzIzLTE2My0xNTk1MTg1NjIwMDAwLSsyMDgxNjIwOTQ4LTc3MDU3MzYzMjcyLTIyNzkzMTg2Nzk5NTk5NTgxOTU'
)// Example result
;({
ad_group: 'customers/3827277046/adGroups/77057363272',
campaign: 'customers/3827277046/campaigns/2081620948',
campaign_budget: 'customers/3827277046/campaignBudgets/6449346162',
dismissed: false,
impact: {
base_metrics: { clicks: 2, cost_micros: 20460000, impressions: 12 },
potential_metrics: { clicks: 4, conversions: 0.05, cost_micros: 36006832, impressions: 110 },
},
keyword_recommendation: {
keyword: { match_type: 2, text: 'google adwords management' },
recommended_cpc_bid_micros: 9600000,
},
resource_name:
'customers/3827277046/recommendations/MTk5MDY3NzIzLTE2My0xNTk1MTg1NjIwMDAwLSsyMDgxNjIwOTQ4LTc3MDU3MzYzMjcyLTIyNzkzMTg2Nzk5NTk5NTgxOTU',
type: 3,
})List every instance of Recommendation
The customer.recommendations.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Recommendation.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a recommendation property. Any other resources that can be selected with recommendation will also be added as properities.
// Listing all the recommendations in the account
let result = await customer.recommendations.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.recommendations.list({
constraints: [
{
key: 'recommendation.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'recommendation.some_field.sub_field',
})// Example result
;[
{
recommendation: {
ad_group: 'customers/3827277046/adGroups/77057363272',
campaign: 'customers/3827277046/campaigns/2081620948',
campaign_budget: 'customers/3827277046/campaignBudgets/6449346162',
dismissed: false,
impact: {
base_metrics: { clicks: 2, cost_micros: 20460000, impressions: 12 },
potential_metrics: { clicks: 4, conversions: 0.05, cost_micros: 36006832, impressions: 110 },
},
keyword_recommendation: {
keyword: { match_type: 2, text: 'google adwords management' },
recommended_cpc_bid_micros: 9600000,
},
resource_name:
'customers/3827277046/recommendations/MTk5MDY3NzIzLTE2My0xNTk1MTg1NjIwMDAwLSsyMDgxNjIwOTQ4LTc3MDU3MzYzMjcyLTIyNzkzMTg2Nzk5NTk5NTgxOTU',
type: 3,
},
campaign_budget: {
amount_micros: 290000000,
delivery_method: 2,
explicitly_shared: false,
has_recommended_budget: false,
id: 6449346162,
name: 'My campaign budget',
period: 2,
reference_count: 1,
resource_name: 'customers/3827277046/campaignBudgets/6449346162',
status: 2,
type: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/77057363272',
campaign: 'customers/3827277046/campaigns/2081620948',
cpc_bid_micros: 9600000,
cpm_bid_micros: 10000000,
cpv_bid_micros: 0,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 12000000,
effective_target_cpa_source: 6,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 77057363272,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/77057363272',
status: 2,
target_cpa_micros: 12000000,
target_cpm_micros: 10000000,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: true },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: true },
{ targeting_dimension: 6, bid_only: true },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: true },
{ targeting_dimension: 9, bid_only: true },
],
},
type: 2,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 2,
base_campaign: 'customers/3827277046/campaigns/2081620948',
bidding_strategy_type: 3,
campaign_budget: 'customers/3827277046/campaignBudgets/6449346162',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [],
geo_target_type_setting: { negative_geo_target_type: 5, positive_geo_target_type: 7 },
id: 2081620948,
labels: [
'customers/3827277046/labels/3889728216',
'customers/3827277046/labels/3889728468',
'customers/3827277046/labels/3889728480',
],
manual_cpc: { enhanced_cpc_enabled: true },
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: true,
target_partner_search_network: false,
target_search_network: false,
},
optimization_score: 0.8309262174345264,
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/2081620948',
serving_status: 2,
start_date: '2019-07-30',
status: 2,
targeting_setting: { target_restrictions: [{ targeting_dimension: 3, bid_only: true }] },
url_custom_parameters: [],
video_brand_safety_suitability: 0,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]RemarketingAction
The RemarketingAction object
Fields
customers/{customer_id}/remarketingActions/{remarketing_action_id}// Example RemarketingAction
const remarketing_action = /* Todo: add example get() return here */Get a RemarketingAction
The customer.remarketingActions.get(resource_name) method returns the RemarketingAction identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that RemarketingAction
Returns
Returns that RemarketingAction as an object.
// Getting the entity
let result = await customer.remarketingActions.get('customers/1234567890/remarketingActions/123123123')// Example result
(/* Todo: add example get() return here */)List every instance of RemarketingAction
The customer.remarketingActions.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of RemarketingAction.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a remarketing_action property. Any other resources that can be selected with remarketing_action will also be added as properities.
// Listing all the remarketingActions in the account
let result = await customer.remarketingActions.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.remarketingActions.list({
constraints: [
{
key: 'remarketing_action.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'remarketing_action.some_field.sub_field',
})// Example result
;[
/* Todo: add example list() return here */
]Create a RemarketingAction
The customer.remarketingActions.create(remarketing_action) method makes a new RemarketingAction in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The RemarketingAction object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const remarketing_action = {
// Your RemarketingAction here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.remarketingActions.create(remarketing_action)
// Passing in an array of entities to create, validating only
const result = await customer.remarketingActions.create([remarketing_action, other_remarketing_action], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/remarketingActions/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a RemarketingAction
The customer.remarketingActions.update(remarketing_action) method changes the attributes of an existing remarketingActions in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The RemarketingAction object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const remarketing_action = {
resource_name: 'customers/1234567890/remarketingActions/123123123', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.remarketingActions.update(remarketing_action)
// Passing in an array of entities to update, validating only
const result = await customer.remarketingActions.update([remarketing_action, other_remarketing_action], {
validate_only: true,
})// Example result
{
results : ['customers/1234567890/remarketingActions/123123123'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a RemarketingAction
The customer.remarketingActions.delete(resource_name) sets the status field of a RemarketingAction to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that RemarketingAction
Returns
Nothing
// Deleting the entity
await customer.remarketingActions.delete('customers/1234567890/remarketingActions/123123123')TopicConstant
The TopicConstant object
Fields
topicConstants/{topic_id}// Example TopicConstant
const topic_constant = {
id: 115,
path: [
'',
'People & Society',
'Family & Relationships',
'Family',
'Parenting',
'Babies & Toddlers',
'Baby Care & Hygiene',
],
resource_name: 'topicConstants/115',
topic_constant_parent: 'topicConstants/1374',
}Get a TopicConstant
The customer.topicConstants.get(resource_name) method returns the TopicConstant identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that TopicConstant
Returns
Returns that TopicConstant as an object.
// Getting the entity
let result = await customer.topicConstants.get('topicConstants/115')// Example result
;({
id: 115,
path: [
'',
'People & Society',
'Family & Relationships',
'Family',
'Parenting',
'Babies & Toddlers',
'Baby Care & Hygiene',
],
resource_name: 'topicConstants/115',
topic_constant_parent: 'topicConstants/1374',
})List every instance of TopicConstant
The customer.topicConstants.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of TopicConstant.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a topic_constant property. Any other resources that can be selected with topic_constant will also be added as properities.
// Listing all the topicConstants in the account
let result = await customer.topicConstants.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.topicConstants.list({
constraints: [
{
key: 'topic_constant.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'topic_constant.some_field.sub_field',
})// Example result
;[
{
topic_constant: {
id: 115,
path: [
'',
'People & Society',
'Family & Relationships',
'Family',
'Parenting',
'Babies & Toddlers',
'Baby Care & Hygiene',
],
resource_name: 'topicConstants/115',
topic_constant_parent: 'topicConstants/1374',
},
},
]UserInterest
The UserInterest object
Fields
customers/{customer_id}/userInterests/{user_interest_id}// Example UserInterest
const user_interest = {
availabilities: [],
launched_to_all: true,
name: 'My user interest',
resource_name: 'customers/9262111890/userInterests/84',
taxonomy_type: 5,
user_interest_id: 84,
user_interest_parent: 'customers/9262111890/userInterests/302',
}Get a UserInterest
The customer.userInterests.get(resource_name) method returns the UserInterest identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that UserInterest
Returns
Returns that UserInterest as an object.
// Getting the entity
let result = await customer.userInterests.get('customers/9262111890/userInterests/84')// Example result
;({
availabilities: [],
launched_to_all: true,
name: 'My user interest',
resource_name: 'customers/9262111890/userInterests/84',
taxonomy_type: 5,
user_interest_id: 84,
user_interest_parent: 'customers/9262111890/userInterests/302',
})List every instance of UserInterest
The customer.userInterests.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of UserInterest.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a user_interest property. Any other resources that can be selected with user_interest will also be added as properities.
// Listing all the userInterests in the account
let result = await customer.userInterests.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.userInterests.list({
constraints: [
{
key: 'user_interest.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'user_interest.some_field.sub_field',
})// Example result
;[
{
user_interest: {
availabilities: [],
launched_to_all: true,
name: 'My user interest',
resource_name: 'customers/9262111890/userInterests/84',
taxonomy_type: 5,
user_interest_id: 84,
user_interest_parent: 'customers/9262111890/userInterests/302',
},
},
]UserList
The UserList object
Fields
- basic_user_list objectUser list targeting as a collection of conversion or remarketing actions.
- crm_based_user_list objectUser list of CRM users provided by the advertiser.
- logical_user_list objectUser list that is a custom combination of user lists and user interests.
- rule_based_user_list objectUser list generated by a rule.
- similar_user_list objectOutput only. User list which are similar to users from another UserList. These lists are readonly and automatically created by google.
customers/{customer_id}/userLists/{user_list_id}// Example UserList
const user_list = {
access_reason: 2,
account_user_list_status: 2,
closing_reason: 0,
description: 'Combined audience based on available data sources',
eligible_for_display: true,
eligible_for_search: true,
id: 509186086,
logical_user_list: {
rules: [
{
operator: 3,
rule_operands_list: [
{ user_list: 'customers/3827277046/userLists/814539380' },
{ user_list: 'customers/3827277046/userLists/508846109' },
{ user_list: 'customers/3827277046/userLists/614318739' },
],
},
],
},
membership_life_span: 30,
membership_status: 2,
name: 'My user list',
read_only: true,
resource_name: 'customers/3827277046/userLists/509186086',
size_for_display: 320,
size_for_search: 490,
size_range_for_display: 2,
size_range_for_search: 2,
type: 3,
}Get a UserList
The customer.userLists.get(resource_name) method returns the UserList identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that UserList
Returns
Returns that UserList as an object.
// Getting the entity
let result = await customer.userLists.get('customers/3827277046/userLists/509186086')// Example result
;({
access_reason: 2,
account_user_list_status: 2,
closing_reason: 0,
description: 'Combined audience based on available data sources',
eligible_for_display: true,
eligible_for_search: true,
id: 509186086,
logical_user_list: {
rules: [
{
operator: 3,
rule_operands_list: [
{ user_list: 'customers/3827277046/userLists/814539380' },
{ user_list: 'customers/3827277046/userLists/508846109' },
{ user_list: 'customers/3827277046/userLists/614318739' },
],
},
],
},
membership_life_span: 30,
membership_status: 2,
name: 'My user list',
read_only: true,
resource_name: 'customers/3827277046/userLists/509186086',
size_for_display: 320,
size_for_search: 490,
size_range_for_display: 2,
size_range_for_search: 2,
type: 3,
})List every instance of UserList
The customer.userLists.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of UserList.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a user_list property. Any other resources that can be selected with user_list will also be added as properities.
// Listing all the userLists in the account
let result = await customer.userLists.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.userLists.list({
constraints: [
{
key: 'user_list.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'user_list.some_field.sub_field',
})// Example result
;[
{
user_list: {
access_reason: 2,
account_user_list_status: 2,
closing_reason: 0,
description: 'Combined audience based on available data sources',
eligible_for_display: true,
eligible_for_search: true,
id: 509186086,
logical_user_list: {
rules: [
{
operator: 3,
rule_operands_list: [
{ user_list: 'customers/3827277046/userLists/814539380' },
{ user_list: 'customers/3827277046/userLists/508846109' },
{ user_list: 'customers/3827277046/userLists/614318739' },
],
},
],
},
membership_life_span: 30,
membership_status: 2,
name: 'My user list',
read_only: true,
resource_name: 'customers/3827277046/userLists/509186086',
size_for_display: 320,
size_for_search: 490,
size_range_for_display: 2,
size_range_for_search: 2,
type: 3,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]Create a UserList
The customer.userLists.create(user_list) method makes a new UserList in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The UserList object or array of objects.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to create will cause the whole operation to be rolled back. Whentrue, the system will still create the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namescreated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Creating the entity
const user_list = {
// Your UserList here, without immutable fields such as resource_name
}
// Passing in a single entity to create
const result = await customer.userLists.create(user_list)
// Passing in an array of entities to create, validating only
const result = await customer.userLists.create([user_list, other_user_list], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/userLists/509186086'],
partial_failure_error : null,
request: { /* your request object */ }
}Update a UserList
The customer.userLists.update(user_list) method changes the attributes of an existing userLists in an account. It also supports an array as its first agument for batch operations.
Arguments
-
entity required
The UserList object or array of objects. These must have a resource_name field set to identify the entity. Any other fields that you set will be updated.
-
options optional
Object of the form
{ validate_only, partial_failure }:-
validate_only optional, boolean
When
true, only checks whether the operation is valid. Makes no changes to your google ads account. Defaults tofalse. -
partial_failure optional, boolean
Only useful when passing in an array of entities. When
false, a single failure in the array of entities to update will cause the whole operation to be rolled back. Whentrue, the system will still update the non-failed entities. Defaults tofalse.
-
Returns
-
results
An array of the
resource_namesupdated. -
partial_failure_error
If
partial_failurewas set totrue, an array of errors. -
request
The request object sent to google's gRPC services. Useful for debugging.
// Updating the entity
const user_list = {
resource_name: 'customers/3827277046/userLists/509186086', // The resource_name is required
// ...any other fields that you would like to update
}
// Passing in a single entity to update
const result = await customer.userLists.update(user_list)
// Passing in an array of entities to update, validating only
const result = await customer.userLists.update([user_list, other_user_list], {
validate_only: true,
})// Example result
{
results : ['customers/3827277046/userLists/509186086'],
partial_failure_error : null,
request: { /* your request object */ }
}Delete a UserList
The customer.userLists.delete(resource_name) sets the status field of a UserList to REMOVED. Those entities and their metrics will continue to exist, but they will be read-only. Removed entities cannot be re-enabled.
Arguments
-
resource_name required
The resource_name of that UserList
Returns
Nothing
// Deleting the entity
await customer.userLists.delete('customers/3827277046/userLists/509186086')Video
The Video object
Fields
customers/{customer_id}/videos/{video_id}// Example Video
const video = {
channel_id: 'UCOSYb4yvogm0SAI8rX8kGWQ',
duration_millis: 40356,
id: 'V_jS8nLLpZI',
resource_name: 'customers/3827277046/videos/Vl9qUzhuTExwWkk',
title: 'Opteo',
}Get a Video
The customer.videos.get(resource_name) method returns the Video identified by a resource_name.
Note: This function is heavily rate-limited by Google, so avoid using it in production.
Arguments
-
resource_name required
The resource_name of that Video
Returns
Returns that Video as an object.
// Getting the entity
let result = await customer.videos.get('customers/3827277046/videos/Vl9qUzhuTExwWkk')// Example result
;({
channel_id: 'UCOSYb4yvogm0SAI8rX8kGWQ',
duration_millis: 40356,
id: 'V_jS8nLLpZI',
resource_name: 'customers/3827277046/videos/Vl9qUzhuTExwWkk',
title: 'Opteo',
})List every instance of Video
The customer.videos.list() returns all of the entities in the account, including REMOVED entities. It also returns all other resources that can be selected with each instance of Video.
This method was designed for convenience and discovery. Internally, it uses the customer.report() method with all attributes fields included. For production code, we recommend using customer.report() with only the fields you need.
Arguments
-
options optional
Object of the form
{ limit, order_by, constraints }:-
limit optional, number
Number of rows to return. Equivalent to the limit in
customer.report(). Defaults to no limit. -
order_by optional, string
The field to sort the returned rows by. Equivalent to the order_by in
customer.report(). By default, no sorting is applied. -
constraints optional, array/object
A constraints array or object. See the
customer.report()documentation for details. By default, all entities are returned.
-
Returns
Returns an array of objects.
Each object has a video property. Any other resources that can be selected with video will also be added as properities.
// Listing all the videos in the account
let result = await customer.videos.list()
// Listing with constraints, sorting, and a limited number of results
let result = await customer.videos.list({
constraints: [
{
key: 'video.some_field',
op: '=',
val: 'yellow submarine',
},
],
limit: 15,
order_by: 'video.some_field.sub_field',
})// Example result
;[
{
video: {
channel_id: 'UCOSYb4yvogm0SAI8rX8kGWQ',
duration_millis: 40356,
id: 'V_jS8nLLpZI',
resource_name: 'customers/3827277046/videos/Vl9qUzhuTExwWkk',
title: 'Opteo',
},
ad_group_ad: {
ad: {
added_by_google_ads: false,
device_preference: 0,
display_url: 'opteo.com',
final_app_urls: [],
final_mobile_urls: [],
final_urls: ['https://opteo.com'],
id: 376678647998,
name: 'Animation',
resource_name: 'customers/3827277046/ads/376678647998',
system_managed_resource_source: 0,
type: 29,
url_collections: [],
url_custom_parameters: [],
video_ad: {
in_stream: { companion_banner: 'customers/3827277046/mediaFiles/4570107325' },
media_file: 'customers/3827277046/mediaFiles/4565915444',
},
},
ad_group: 'customers/3827277046/adGroups/55719719421',
ad_strength: 0,
policy_summary: { approval_status: 4, policy_topic_entries: [], review_status: 3 },
resource_name: 'customers/3827277046/adGroupAds/55719719421~376678647998',
status: 2,
},
ad_group: {
ad_rotation_mode: 0,
base_ad_group: 'customers/3827277046/adGroups/55719719421',
campaign: 'customers/3827277046/campaigns/1546686126',
cpc_bid_micros: 0,
cpm_bid_micros: 10000,
cpv_bid_micros: 100000,
display_custom_bid_dimension: 0,
effective_target_cpa_micros: 0,
effective_target_cpa_source: 0,
effective_target_roas_source: 0,
explorer_auto_optimizer_setting: { opt_in: false },
id: 55719719421,
labels: [],
name: 'My ad group',
resource_name: 'customers/3827277046/adGroups/55719719421',
status: 2,
target_cpa_micros: 0,
targeting_setting: {
target_restrictions: [
{ targeting_dimension: 3, bid_only: false },
{ targeting_dimension: 4, bid_only: false },
{ targeting_dimension: 5, bid_only: false },
{ targeting_dimension: 6, bid_only: false },
{ targeting_dimension: 7, bid_only: false },
{ targeting_dimension: 8, bid_only: false },
{ targeting_dimension: 9, bid_only: false },
],
},
type: 9,
url_custom_parameters: [],
},
campaign: {
ad_serving_optimization_status: 2,
advertising_channel_sub_type: 0,
advertising_channel_type: 6,
base_campaign: 'customers/3827277046/campaigns/1546686126',
bidding_strategy_type: 13,
campaign_budget: 'customers/3827277046/campaignBudgets/1601905358',
end_date: '2037-12-30',
experiment_type: 2,
frequency_caps: [{ key: { level: 4, event_type: 2, time_unit: 2, time_length: 1 }, cap: 1 }],
geo_target_type_setting: { negative_geo_target_type: 5, positive_geo_target_type: 7 },
id: 1546686126,
labels: ['customers/3827277046/labels/3353203258'],
manual_cpv: {},
name: 'My campaign',
network_settings: {
target_content_network: false,
target_google_search: false,
target_partner_search_network: false,
target_search_network: false,
},
payment_mode: 4,
resource_name: 'customers/3827277046/campaigns/1546686126',
serving_status: 2,
start_date: '2018-09-07',
status: 2,
url_custom_parameters: [],
video_brand_safety_suitability: 3,
},
customer: {
auto_tagging_enabled: true,
call_reporting_setting: {
call_conversion_action: 'customers/3827277046/conversionActions/179',
call_conversion_reporting_enabled: true,
call_reporting_enabled: true,
},
conversion_tracking_setting: { conversion_tracking_id: 875176189 },
currency_code: 'GBP',
descriptive_name: 'My customer',
final_url_suffix:
'wickedsource=google&wickedid={creative}&wtm_term={ifsearch:{keyword}}{ifcontent:{placement}}&wtm_campaign={campaignid}&wtm_content={adgroupid}&wickedplacement={placement}&wickedkeyword={keyword}&gclid={gclid}',
has_partners_badge: false,
id: 3827277046,
manager: false,
optimization_score: 0.8214771414132993,
pay_per_conversion_eligibility_failure_reasons: [],
remarketing_setting: {
google_global_site_tag:
"<!-- Global site tag (gtag.js) - Google Ads: 875176189 -->\n<script async src=\"https://www.googletagmanager.com/gtag/js?id=AW-875176189\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', 'AW-875176189');\n</script>\n",
},
resource_name: 'customers/3827277046',
test_account: false,
time_zone: 'Europe/London',
tracking_url_template:
'https://w.opteo.co/workers/ct?url={lpurl}&domain_id=123443&campaign_id={campaignid}&adgroup_id={adgroupid}&matchtype={matchtype}&network={network}&device={device}&keyword={keyword}&targetid={targetid}',
},
},
]