Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ProductCondition Listing Group Filter issues #838

Closed
usagreatus opened this issue Aug 1, 2022 · 13 comments
Closed

ProductCondition Listing Group Filter issues #838

usagreatus opened this issue Aug 1, 2022 · 13 comments
Assignees
Labels
bug Something isn't working triage Need triage

Comments

@usagreatus
Copy link

usagreatus commented Aug 1, 2022

Your client library and Google Ads API versions:

  • Client library version: v15.1.0
  • Google Ads API version: V11

Your environment:

  • The PHP version: 8.0.20.
  • The name and version of the operating system: Linux 45b930250aa4 5.10.104-linuxkit.
  • Whether the PHP Extension protobuf is used or not: No.
  • Whether the PHP Extension grpc is used or not: 1.46.3.
  • The type of transport being used (grpc or rest): grpc.

Description of the bug:
I have problems creating ListingGroupFilter for an Asset Group in Performance Max Campaign via Ads API. I tried creating ListingGroup filter by ProductCondition value new. I got a success response but checking it in the google ads ui showed that the filter has value refurbished. I then created another product condition filter in goole ads ui with value new. And after that did a search query to get listing group filters for the asset group that i am testing on. The response shows the condition value as 2, which is not a valid value in php sdk enum class ProductCondition. I can't map the response using enum class, cause value is not valid. Also tried to create a filter with value used, and it fails with error: Enum value 'UNKNOWN_ENUM_VALUE_ListingGroupFilterProductCondition_5' cannot be used
Enum class in google ads php sdk: https://github.com/googleads/google-ads-php/blob/v15.1.0/src/Google/Ads/GoogleAds/V11/Enums/ProductConditionEnum/ProductCondition.php
Steps to reproduce:
Detailed description of the issue and with code samples screenshots:
https://groups.google.com/g/adwords-api/c/IIIZsibINRI

@usagreatus usagreatus added bug Something isn't working triage Need triage labels Aug 1, 2022
@fiboknacky
Copy link
Member

Whether the PHP Extension protobuf is used or not: No.
Do you mean you use the C implementation instead?
Could you please provide the protobuf version number?

It seems like your issue is already fixed in protobuf v21.0, so if you're using this version or higher, the issue should be gone.
If not, please let me know.

@fiboknacky fiboknacky self-assigned this Aug 2, 2022
@usagreatus
Copy link
Author

I had no php extension for protobuf, so it was using composer package which was V3.21.1. I installed php protobuf extension:

# php -r 'print phpversion("protobuf");'
3.21.4# 

https://github.com/protocolbuffers/protobuf/releases

Unfortunately I still have issue with product condition values mismatch

@fiboknacky
Copy link
Member

Instead of screenshots, could you please copy text over here, so we can take a closer look?
Some screenshots are too small and I cannot see the details inside them clearly.

@usagreatus
Copy link
Author

usagreatus commented Aug 3, 2022

Instead of screenshots, could you please copy text over here, so we can take a closer look? Some screenshots are too small and I cannot see the details inside them clearly.

Sure. I have a performance max retail campaign, and trying to create asset group listing group filter under an asset group. I created a root listing group and then I create an instance of ProductCondition, then put it in AssetGroupListingGroupFilter and AssetGroupListingGroupFilterOperation and send operations, which does successful mutate request but in the ads ui the condition is not new but refurbished:

$conditionInfo = new ProductCondition();
$conditionInfo->setCondition(ProductConditionEnum::value("PBNEW");
$dimension = new ListingGroupFilterDimension(
    ['product_condition' => $conditionInfo]
);
$assetGroupListingGroupFilter = new AssetGroupListingGroupFilter([
    'resource_name' => ResourceNames::forAssetGroupListingGroupFilter(
        $customerId,
        $assetGroupId,
            $this->tempId
        ),
    'asset_group' => ResourceNames::forAssetGroup($customerId, $assetGroupId),
    'parent_listing_group_filter' => $parentsResourceName,
    'type' => $type,
    'vertical' => ListingGroupFilterVertical::SHOPPING,
    'case_value' => $dimension
]);

After this i just go to google ads account and add one more listing group filter by product condition with value new.
and i do search query to get listing group filters:

SELECT

asset_group_listing_group_filter.asset_group,
asset_group_listing_group_filter.id,
asset_group_listing_group_filter.parent_listing_group_filter,
asset_group_listing_group_filter.resource_name,
asset_group_listing_group_filter.type,
asset_group_listing_group_filter.vertical,
asset_group_listing_group_filter.case_value.product_type.value,
asset_group_listing_group_filter.case_value.product_type.level,
asset_group_listing_group_filter.case_value.product_item_id.value,
asset_group_listing_group_filter.case_value.product_custom_attribute.value,
asset_group_listing_group_filter.case_value.product_custom_attribute.index,
asset_group_listing_group_filter.case_value.product_condition.condition,
asset_group_listing_group_filter.case_value.product_channel.channel,
asset_group_listing_group_filter.case_value.product_brand.value,
asset_group_listing_group_filter.case_value.product_bidding_category.level,
asset_group_listing_group_filter.case_value.product_bidding_category.id

FROM asset_group_listing_group_filter

WHERE
asset_group_listing_group_filter.asset_group = 'customers/xxxxxxxxxx/assetGroups/xxxxxxxxxxxxx'

I get back response with 4 asset group listing group filters: a root one and 3 children with case value ProductCondition. they have values: 3 (this one was created by me via api), 0 - everything else node (also created via api), 2 (this one i created in google ads ui directly, and the enum class doesn't have mapping for it): https://github.com/googleads/google-ads-php/blob/v15.1.0/src/Google/Ads/GoogleAds/V11/Enums/ProductConditionEnum/ProductCondition.php#L21-L45
so in the enum class when it tries to get name by value it fails validation because there is no mapping to value 2, here:

@fiboknacky
Copy link
Member

Sorry for the back-and-forth. Could you also share the latest request ID when you ran the above query?
Thanks.

@usagreatus
Copy link
Author

Sorry for the back-and-forth. Could you also share the latest request ID when you ran the above query? Thanks.

Hi, yes sure. The request id of the searchStream query: xgi-kOivunc5gUJrgoE9Hg

@fiboknacky
Copy link
Member

fiboknacky commented Aug 4, 2022

Thank you. BTW, could you try using search instead of searchStream? Unfortunately, due to a limitation, I cannot see the raw response when searchStream is used.

@usagreatus
Copy link
Author

Thank you. BTW, could you try using search instead of searchStream? Unfortunately, due to a limitation, I cannot see the raw response when searchStream is used.

Yea, I can totally do it. Do you know how to extract the request_id from a search request?

I can see it in SearchStreamResponse, but don't see it in SearchResponse

@usagreatus
Copy link
Author

Thank you. BTW, could you try using search instead of searchStream? Unfortunately, due to a limitation, I cannot see the raw response when searchStream is used.

Yea, I can totally do it. Do you know how to extract the request_id from a search request?

I can see it in SearchStreamResponse, but don't see it in SearchResponse

I figured it out, i had to build client with logger, here are the details of the request:

Method: "/google.ads.googleads.v11.services.GoogleAdsService/Search", CustomerId: xxxxxxx, RequestId: "9jOV9G3ksHWQ3E4GvY4YiA"

let me know if you need more info.

@fiboknacky
Copy link
Member

fiboknacky commented Aug 5, 2022

(This answer has been edited)

Thank you, but I cannot reproduce the issue by using both C and PHP implementations of the protobuf extension.
Could you try calling $googleAdsRow->getAssetGroupListingGroupFilter()->getCaseValue()->getProductCondition()->getCondition() where $googleAdsRow is one row when you loop over the result?

I got something like this and cannot see the value 5 that would break the enum's name() method.

{"resourceName":"customers/4900036901/assetGroupListingGroupFilters/6449226683~6540088053","id":"6540088053","caseValue":{"productCondition":{"condition":"REFURBISHED"}}}

In the meantime, could you share the code where you print the result from search() too?

Right now, it looks like your asset group has three listing group filters: UNIT_INCLUDED (the one that has REFURBISHED as a product condition), UNIT_EXCLUDED, and SUBDIVISION.

@usagreatus
Copy link
Author

(This answer has been edited)

Thank you, but I cannot reproduce the issue by using both C and PHP implementations of the protobuf extension. Could you try calling $googleAdsRow->getAssetGroupListingGroupFilter()->getCaseValue()->getProductCondition()->getCondition() where $googleAdsRow is one row when you loop over the result?

I got something like this and cannot see the value 5 that would break the enum's name() method.

{"resourceName":"customers/4900036901/assetGroupListingGroupFilters/6449226683~6540088053","id":"6540088053","caseValue":{"productCondition":{"condition":"REFURBISHED"}}}

In the meantime, could you share the code where you print the result from search() too?

Right now, it looks like your asset group has three listing group filters: UNIT_INCLUDED (the one that has REFURBISHED as a product condition), UNIT_EXCLUDED, and SUBDIVISION.

Hi! Ok, thanks for looking into it. So we get back REFURBISHED. But what is the issue here that - in the mutate request i sent it as NEW not REFURBISHED. I send NEW and in ads ui it appears to be REFURBISHED. You can see it in the code above i provided, i will paste it here again:

$conditionInfo = new ProductCondition();
$conditionInfo->setCondition(ProductConditionEnum::value("PBNEW"); // <- here it is set to new, and after a successful mutate request i go to ads account, it's not new it's refurbished
$dimension = new ListingGroupFilterDimension(
    ['product_condition' => $conditionInfo]
);

i can make a mutate request again and send you the request id if you need it, thank you

@fiboknacky
Copy link
Member

You used a wrong enum class. The correct one is ListingGroupFilterProductCondition.

In addition, you can do like this:

$conditionInfo->setCondition(ListingGroupFilterProductCondition::PBNEW); 

@usagreatus
Copy link
Author

You used a wrong enum class. The correct one is ListingGroupFilterProductCondition.

In addition, you can do like this:

$conditionInfo->setCondition(ListingGroupFilterProductCondition::PBNEW); 

Oh my, that's true. Everything is good now. Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Need triage
Projects
None yet
Development

No branches or pull requests

2 participants