GithubHelp home page GithubHelp logo

Comments (4)

kritzware avatar kritzware commented on August 16, 2024 1

Hi @Sotacan, it's pretty late here right now, but I'll take a look tomorrow and get back to you!

from google-ads-node.

kritzware avatar kritzware commented on August 16, 2024 1

So it looks like the phone_call_duration_seconds is now causing issues. If you use a try/catch block like I mentioned previously, this error would be visible in your terminal!

It seems to not allow phone_call_duration_seconds to be set when using the type: enums.ConversionActionType.WEBPAGE. I managed to get it working when setting the type to enums.ConversionActionType.AD_CALL.

Again, I'm not an expert in all the settings for conversion actions, so it may be worth getting in contact with the Google Ads API support team.

from google-ads-node.

kritzware avatar kritzware commented on August 16, 2024

Hi @Sotacan, I've taken a look and found a solution to your issue.

It looks as if you were not correctly specifying the type field of the conversion action object. The value 0 means UNSPECIFIED, which I assume isn't allowed in Google Ads? (I may be wrong here). If I set that to another value, the request appears to work.

Using this as the conversion action object works for me:

const conversion = {
    name: 'my-conversion-action',
    status: enums.ConversionActionStatus.ENABLED,
    type: enums.ConversionActionType.AD_CALL,
    category: enums.ConversionActionCategory.PURCHASE,
    include_in_conversions_metric: true,
    click_through_lookback_window_days: 30,
    // view_through_lookback_window_days: 1,
    attribution_model_settings: {
        attribution_model: enums.AttributionModel.GOOGLE_ADS_LAST_CLICK,
    },
    value_settings: {
        // always_use_default_value: false,
        default_currency_code: 'USD',
        default_value: 1,
    },
}

I've commented out two fields which appear to cause problems, perhaps they can't be set when initially creating the conversion action.

I'd highly recommend using the enums import instead of using the direct values, e.g.

status: enums.ConversionActionStatus.ENABLED, // good
status: 1, // bad

The enums module can be imported with GoogleAdsApi, like so:

const { GoogleAdsApi, enums } = require('google-ads-api');

I would also strongly recommend using TypeScript if possible. This will allow you to use the types import, which makes working with theses complex objects much easier.

You can also get much better debugging information if you wrap your code in a try/catch block, and avoid using the setTimeout:

try {
    const result = await customer.conversionActions.create(conversion_action)
    console.log(result)
} catch (err) {
    console.log('Error creating conversion action:')
    // The err object includes details on which particular key is missing
    console.log(err)
}

Let me know if you still have problems!

from google-ads-node.

Sotacan avatar Sotacan commented on August 16, 2024

Hmm i have the same issue, and thanks enums is sweet.

https://gyazo.com/26afd8a417a05645240fb9a79829d04c

from google-ads-node.

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.