TypeScript typings for Google Ads API v5
Manage your Google Ads accounts, campaigns, and reports with this API.
For detailed description please check documentation.
Installing
Install typings for Google Ads API:
npm install @types/gapi.client.googleads-v5 --save-dev
Usage
You need to initialize Google API client in your code:
gapi.load('client', () => {
});
Then load api client wrapper:
gapi.client.load('https://googleads.googleapis.com/$discovery/rest?version=v5', () => {
});
gapi.client.load('googleads', 'v5', () => {
});
Don't forget to authenticate your client before sending any request to resources:
var client_id = '',
scope = [
'https://www.googleapis.com/auth/adwords',
],
immediate = true;
gapi.auth.authorize(
{ client_id: client_id, scope: scope, immediate: immediate },
authResult => {
if (authResult && !authResult.error) {
} else {
}
});
After that you can use Google Ads API resources: