googleads
Access Google Ads REST API (json based) from Node.js.
Install
npm -i @honkandgo/googleads
Use
import GoogleAdsClient from '@honkandgo/googleads'
const googleads = new GoogleAdsClient({
clientId: <GOOGLE_CLIENT_ID>
clientSecret: <GOOGLE_CLIENT_SECRET>
developerToken: <GOOGLE_ADS_DEVELOPER_TOKEN>
refreshToken: <REFRESH_TOKEN> (optional)
})
const { resourceNames } = await googleads.listAccessibleCustomers()
Passing refreshToken in constructor is optional. You can also pass refreshToken as a parameter to any method
const refreshToken = ...
const customerId = ...
const query = "SELECT campaign.id, campaign.name FROM campaign WHERE campaign.status IN ('ENABLED', 'PAUSED')"
const campaigns = await googleads.search(customerId, { query }, refreshToken)