Google Ads API - Optimize Campaign By Specific Conversion Action(s)

Viewed 99

I am using Google Ads PHP library to create Campaign.

I created almost any type of campaigns but didn't manage to optimize them by specific Conversion Actions.

For example:

I have created 3 different Conversion Actions:

customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_0] customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_1] customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_2]

Then I created a Campaign:

customers/[CUSTOMER_ID]/campaigns/[CAMPAIGN_ID]

I set bidding strategy to MAXIMIZE_CONVERSIONS and then tried to set Conversion Actions to optimize to. This is my code snippet:

$campaign->setMaximizeConversions(
  new CommonMaximizeConversions([
    'target_cpa' => $this->convert()->micros(1)
  ])
);

$campaign->setSelectiveOptimization(
  new SelectiveOptimization([
    'conversion_actions' => [
      'customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_0]',
      'customers/[CUSTOMER_ID]/conversionActions/[CONVERSION_ACTION_ID_1]'
    ]
  ])
);

It gives me this error:

{
    "message": {
        "message": "Request contains an invalid argument.",
        "code": 3,
        "status": "INVALID_ARGUMENT",
        "details": [
            {
                "@type": "type.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure",
                "errors": [
                    {
                        "errorCode": {
                            "requestError": "UNKNOWN"
                        },
                        "message": "The error code is not in this version.",
                        "trigger": {
                            "stringValue": ""
                        },
                        "location": {
                            "fieldPathElements": [
                                {
                                    "fieldName": "operations",
                                    "index": 0
                                },
                                {
                                    "fieldName": "create"
                                },
                                {
                                    "fieldName": "selective_optimization"
                                },
                                {
                                    "fieldName": "conversion_actions"
                                }
                            ]
                        }
                    }
                ],
                "requestId": "xbgMUFFeP4447GFW_nJrIA"
            }
        ]
    },
}

Can you tell me what I am doing wrong? Or suggest any help?.

Thanks.

0 Answers
Related