GithubHelp home page GithubHelp logo

Comments (4)

avermeil avatar avermeil commented on June 30, 2024

Hey!

Try something like this:

const campaign_criterion = {
  campaign: 'customers/xxxxxxx/campaigns/xxxxxxxxx',
  location: { geo_target_constant: 'geoTargetConstants/2004' }
}

const result = await customer.campaignCriterion.create(campaign_criterion)

I haven't tested this snippet, but that's the general structure :)

from google-ads-api.

irohitb avatar irohitb commented on June 30, 2024

Interesting and thanks for responding,

What would be the geoTargetConstants/2004? Is it in general location ID (the 2004)

Something like geoTargetConstants/${locationID} if not, how can we make geoTargetConstants/2004 ?

from google-ads-api.

avermeil avatar avermeil commented on June 30, 2024

Yes, it's the locationID. You can get every single geoTargetConstant and their associated location IDs by running:

const result = await customer.geoTargetConstants.list()

I don't think we provide any helper functions to build resource names from IDs yet, but we might in the future. The idea, according to Google, is that you're supposed to use the resource names instead of IDs.

from google-ads-api.

irohitb avatar irohitb commented on June 30, 2024

Okay, To start with I did something pretty simple

  const glkData = {
         campaign: cachedandTargetData.campaignPath, //My Campaign Path 
         name: googleAdData.name,
         age_range: "AGE_RANGE_18_24",
       }

 const targetingData = await this.customer.campaignCriterion.create(glkData)

I also tried combinations with age Range like passing an array

age_range: ["AGE_RANGE_18_24"],
enums.AgeRangeType["AGE_RANGE_18_24"]

but it keeps throwing following error

Criteria type can not be targeted.

Others were easy because resources had an example for them. Can you please help me out on this one?

from google-ads-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.