Hello Anthony,
Many thanks for your reply!
As you suggested I tried to use the
CampaignCriterionService, and have the following code. It gives me an error message "Resource_Name_Missing", but I am unsure how to add this parameter. I tried to include it in several ways but was not successful. Maybe you can help me out?
Again, many thanks for your help!
Kind regards,
Christoph
private static function createDeviceCampaignCriterionOperation(
$languageId,
$campaignResourceName
) {
$campaignCriterion = new CampaignCriterion([
'campaign' => new StringValue(['value' => $campaignResourceName]),
'device' => new DeviceInfo (['type' => Device::MOBILE]),
'bid_modifier' => new FloatValue(['value' => '2'])
]);
return new CampaignCriterionOperation(['update' => $campaignCriterion]);
}
Error Message:
ApiException was thrown with message '{
"message": "Request contains an invalid argument.",
"code": 3,
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": 0,
"data": "
type.googleapis.com\/google.ads.googleads.v0.errors.GoogleAdsFailure"
},
{
"@type": 0,
"data": [
{
"errorCode": {
"requestError": "RESOURCE_NAME_MISSING"
},
"message": "Resource name is missing.",
"location": {
"fieldPathElements": [
{
"fieldName": "operations",
"index": "0"
},
{
"fieldName": "update"
},
{
"fieldName": "resource_name"
}
]
}
}
]
}
]
}'.