How to use the google-ads-api.enums.AdGroupCriterionStatus 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_keywords.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.Keyword" for autocomplete!
    const keyword = {
        ad_group: 'customers/123/adGroups/321',
        status: enums.AdGroupCriterionStatus.ENABLED,
        keyword: {
            text: 'hotels london',
            match_type: enums.KeywordMatchType.EXACT,

    try {
        const { results } = await customer.adGroupCriterion.create(keyword)
            The newly created ad group criterion will have a resource name in the following format:
    } catch (err) {
        if (err.code.adGroupCriterionError === enums.AdGroupCriterionError.INVALID_KEYWORD_TEXT) {
            console.log(`Keyword with text "${keyword.text}" is invalid!`)