How to use the google-ads-api.enums.CampaignStatus 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.

github Opteo / google-ads-api / examples / basic_operations / add_campaign.js View on Github external
async function main() {
    const customer = client.Customer({
        customer_account_id: '<CUSTOMER_ACCOUNT_ID>',
        refresh_token: '<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,
        status: enums.CampaignStatus.PAUSED,
    }

    try {
        const { results } = await customer.campaigns.create(campaign)
        /*
            The newly created campaign will have a resource name in the following format:
            "customers/{customer_id}/campaigns/{campaign_id}"
        */
    } catch (err) {
        console.log(err)
    }
}