google-ads-api
google-ads-api copied to clipboard
Missing ad enum field ?
Hi guys,
Trying to migrate to v5 i found this strange behavior:
const myAd: MutateOperation<resources.IAd> = {
entity: 'ad',
...
}
This kind of declaration give me an error due the missing ad
resource! From my knowledge and ads reference this resource should exist! There is something that I have miss ?
I believe you should be using the ad_group_ad
resource here.
Thanks for the response, I will make some tests! There are cases in updating resources where you need specify if the operation is on a ad_group_ad
resource or on a ad
resource this is why I introduce this resource type on the equation! I will make some test and report here if your suggestion solve the problem!
I need some time to create a reproducible example but if you see here in the docs the ad
field of a ad_group_ad
is not updatable! Instead if you refer to the ad directly with resource type ad
you can update its internal properties.
Hi, I can confirm that is not possible using the GoogleAdsService
modify the ad
property of an ad_group_ad
resource. If you try to do that you obtain this error:
GoogleAdsFailure {
errors: [
GoogleAdsError {
error_code: ErrorCode { request_error: 11 },
message: "Field 'ad.expanded_text_ad.description' cannot be modified by 'UPDATE' operation.",
location: ErrorLocation {
field_path_elements: [
FieldPathElement {
field_name: 'mutate_operations',
index: 2
},
FieldPathElement { field_name: 'ad_group_ad_operation' },
FieldPathElement { field_name: 'update' },
FieldPathElement { field_name: 'ad' },
FieldPathElement { field_name: 'expanded_text_ad' },
FieldPathElement { field_name: 'description' }
]
}
},
{
...
}
]
}
The only way that I have found is refer directly to the ad
resource. I mean.. this not a big problem if you put the ad
entity and you avoid to use type only in that case all works fine but in my opinion, here the ad
entity is missing.
Hi @Zikoel. We generate the Resource
type using the SearchGoogleAdsFieldsRequest
service. This type is subsequently used for the entity
key in the MutateOperation
type. I have just run this manually and no Ad
resource is returned by the service. I will contact Google soon to see if they can provide any further information on why the service is behaving this way.
I'm facing the same issue: once the ad_group_ad
is created, it's not possible to mutate the associated ad data via the ad_group_ad
entity (note that in the docs, ad_group_ad.ad
is immutable).
Instead, we need to mutate the ad
using an ad update operation:
const operation: MutateOperation<resources.IAd> = {
entity: "ad",
resource: {
resource_name": "customers/123456789/ads/123456789",
final_urls": [
"https://www.example.com"
],
}
}
However, as pointed by @Zikoel, this currently triggers a TypeScript error because ad
is not part of fields.Resource
(the type of the operation entity
).
@avermeil @Josecamero @wcoots is it something you could have a look?