How to use the google-ads-api.GoogleAdsApi function in google-ads-api

To help you get started, we’ve selected a few google-ads-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Opteo / google-ads-api / examples / basic_operations / add_expanded_text_ad.js View on Github external
const { GoogleAdsApi, enums } = require('google-ads-api')

// Make sure you pass in valid authentication details!
const client = new GoogleAdsApi({
    client_id: '',
    client_secret: '',
    developer_token: '',
})

async function main() {
    const customer = client.Customer({
        customer_account_id: '',
        refresh_token: '',
    })

    // Bonus: If you're using Typescript, set the type here to "types.AdGroupAd" for autocomplete
    const ad = {
        ad_group: 'customers/{customer_id}/adGroups/{ad_group_id}',
        status: enums.AdGroupAdStatus.PAUSED,
        ad: {
github Opteo / google-ads-api / examples / basic_operations / get_ad_groups.js View on Github external
const { GoogleAdsApi, enums } = require('google-ads-api')

// Make sure you pass in valid authentication details!
const client = new GoogleAdsApi({
    client_id: '',
    client_secret: '',
    developer_token: '',
})

async function main() {
    const customer = client.Customer({
        customer_account_id: '',
        refresh_token: '',
    })

    try {
        const results = await customer.report({
            entity: 'ad_group',
            attributes: ['campaign.id', 'ad_group.id', 'ad_group.name'],
            constraints: [{ 'ad_group.status': enums.AdGroupStatus.ENABLED }],
github Opteo / google-ads-api / examples / basic_operations / add_keywords.js View on Github external
const { GoogleAdsApi, enums } = require('google-ads-api')

// Make sure you pass in valid authentication details!
const client = new GoogleAdsApi({
    client_id: '',
    client_secret: '',
    developer_token: '',
})

async function main() {
    const customer = client.Customer({
        customer_account_id: '',
        refresh_token: '',
    })

    // Bonus: If you're using Typescript, set the type here to "types.Keyword" for autocomplete!
    const keyword = {
        ad_group: 'customers/123/adGroups/321',
        status: enums.AdGroupCriterionStatus.ENABLED,
        keyword: {
github Opteo / google-ads-api / examples / reporting / get_ads_performance.js View on Github external
const { GoogleAdsApi, enums } = require('google-ads-api')

// Make sure you pass in valid authentication details!
const client = new GoogleAdsApi({
    client_id: '',
    client_secret: '',
    developer_token: '',
})

async function main() {
    const customer = client.Customer({
        customer_account_id: '',
        refresh_token: '',
    })

    try {
        const results = await customer.report({
            entity: 'ad_group_ad',
            attributes: ['ad_group.id', 'ad_group_ad.ad.id'],
            metrics: ['metrics.clicks', 'metrics.impressions'],
github Opteo / google-ads-api / examples / basic_operations / add_ad_group.js View on Github external
const { GoogleAdsApi } = require('google-ads-api')

// Make sure you pass in valid authentication details!
const client = new GoogleAdsApi({
    client_id: '',
    client_secret: '',
    developer_token: '',
})

async function main() {
    const customer = client.Customer({
        customer_account_id: '',
        refresh_token: '',
    })

    // Bonus: If you're using Typescript, set the type here to "types.AdGroup" for autocomplete
    const adgroup = {
        name: 'new ad group',
        campaign: `customers/{customer_id}/campaigns/{campaign_id}`,
    }
github Opteo / google-ads-api / examples / basic_operations / add_campaign.js View on Github external
const { GoogleAdsApi, enums } = require('google-ads-api')

// Make sure you pass in valid authentication details!
const client = new GoogleAdsApi({
    client_id: '',
    client_secret: '',
    developer_token: '',
})

async function main() {
    const customer = client.Customer({
        customer_account_id: '',
        refresh_token: '',
    })

    // Bonus: If you're using Typescript, set the type here to "types.Campaign" for autocomplete
    const campaign = {
        name: 'new-campaign',
        campaign_budget: 'customers/{customer_id}/campaignBudgets/{campaign_budget_id}',
        advertising_channel_type: enums.AdvertisingChannelType.SEARCH,