I am currently working on a project where I need to construct a detailed, tree-like view of product partitions for shopping campaigns, including both subdivisions (intermediate nodes) and units (leaf nodes).
I am in the process of retrieving listing_group data. I would like to know if there is a way to GET both SUBDIVISIONS and UNITS together. Or would I have to make two separate request and combine the data (someway on server-side or client)?
My aim is to return the complete product partition tree for my currently active Google Ads Shopping campaigns. Right now I am under the impression I need to do both separately.
For Example I am using this query :
SELECT
ad_group_criterion.listing_group.type,
ad_group_criterion.listing_group.case_value.product_type.level,
ad_group_criterion.listing_group.case_value.product_type.value,
ad_group_criterion.listing_group.case_value.product_item_id.value,
ad_group_criterion.listing_group.parent_ad_group_criterion,
ad_group_criterion.listing_group.path,
FROM ad_group_criterion
WHERE
ad_group_criterion.listing_group.type = 'SUBDIVISION'
I mapped over the result and logged the object for listing_group.
(random numbers to remove my actual ids)
[
{
type: 2,
case_value: null,
parent_ad_group_criterion: 'customers/customerId/adGroupCriteria/1~6',
path: xt { dimensions: [Array] }
},
{
type: 2,
case_value: null,
parent_ad_group_criterion: null,
path: xt { dimensions: [] }
},
{
type: 2,
case_value: { product_type: [Object], product_item_id: null },
parent_ad_group_criterion: 'customers/customerId/adGroupCriteria/1~6',
path: xt { dimensions: [Array] }
}
]
I then logged the paths:
[
[ Ut { product_brand: [Kt] } ],
[],
[ Ut { product_brand: [Kt] }, Ut { product_type: [Xt] } ]
]
My impression is this is the root node, brand node and product type node, which would then lead to my product_item_ids.
Is it possible to query both subdivisions and units in the results?
Michael H.