Google Ads API
Unofficial Google Ads API client library for Node
- 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
The Google Ads API is the new replacement to the AdWords API. Google will deprecate the AdWords API sometime in 2020.
$ yarn add google-ads-api
You can find the full documentation here.
The documentation is divided into two main sections:
- General concepts for general usage of this library.
- Core resources for the specific fields and methods available per resource.
// 1. Create a new client with your credentialsconst client =client_id: '<CLIENT_ID>'client_secret: '<CLIENT_SECRET>'developer_token: '<DEVELOPER_TOKEN>'// 2. Load a customer with a valid CID & authenticationconst customer = client// 3. Use the query method for querying customer dataconst response = await customer// 4. Inspect the data and benefit from ts definitionsfor const row of responseconst ad_group metrics = rowif ad_groupstatus === enumsAdGroupStatusENABLEDconsole// 5. Create a new campaignconst campaign =name: 'New Campaign'campaign_budget: 'customers/123/campaignBudgets/123'advertising_channel_type: enumsAdvertisingChannelTypeSEARCHstatus: enumsCampaignStatusPAUSEDconst results = await customercampaignsconst new_campaign_resource_name = results0// 6. ...modify it...await customercampaigns// 7. ...and delete it.await customercampaigns
There are many more examples in the full documentation.
You can also find a couple ready-to-run examples in this branch.