So, after I successfully remove the node and begin to recreate it as a 
subdivision with children, I am getting an error at index 1 where it says 
the 'listing_group already exists'. This is my "other's node" operation.

//new subdivided node
const updateSelectedNodeType = new resources.AdGroupCriterion({
    resource_name: tempSubdivisionResource,
    ad_group: adGroupResource,
    listing_group: {
      parent_ad_group_criterion: parentNode,
      type: enums.ListingGroupType.SUBDIVISION,
      case_value: caseValue,
    },
    negative: false,
    status: enums.AdGroupCriterionStatus.ENABLED,
  });
//everything else node
  const everythingElseNode = new resources.AdGroupCriterion({
    resource_name: everythingElseResource,
    ad_group: adGroupResource,
    cpc_bid_micros: toMicros(0.4),
    listing_group: {
      parent_ad_group_criterion: parentNode,
      type: enums.ListingGroupType.UNIT,
      case_value: everythingElseCaseValue,
    },
    negative: false,
    status: enums.AdGroupCriterionStatus.ENABLED,
  });
 //partition object with set cpc.
        const newPartition = new resources.AdGroupCriterion({
          ad_group: `customers/${customer}/adGroups/${adGroupId}`,
          resource_name: criterionResourceOperation,
          cpc_bid_micros: toMicros(0.4),
          negative: false,
          status: enums.AdGroupCriterionStatus.ENABLED,
          listing_group: {
            parent_ad_group_criterion: parentAdGroupCriterion,
            type: enums.ListingGroupType.UNIT,
            case_value: caseValue,
          },
        });


0//tempid -1 
 const updatePartitionToSubdivision: MutateOperation<resources.
IAdGroupCriterion> =
    {
      entity: "ad_group_criterion",
      operation: "create",
      resource: {
        ...updateSelectedNodeType,
      },
    };

1//tempid -2 - ERROR - LISTING_GROUP ALREADY EXISTS
  const createEverythingElseNodeOperation: MutateOperation<resources.
IAdGroupCriterion> =
    {
      entity: "ad_group_criterion",
      operation: "create",
      resource: {
        ...everythingElseNode,
      },
    };
  
2//tempid -3
 const addPartitionNodes: MutateOperation<resources.IAdGroupCriterion> =
          {
            entity: "ad_group_criterion",
            operation: "create",
            resource: newPartition,
          };


How do I find a node that doesn't currently exist in my active tree, remove 
it and make sure I am not removing the wrong node? 

I tried to query:
    query = `
        SELECT 
        ad_group_criterion.criterion_id,
        ad_group_criterion.listing_group.case_value.${caseValue},
        ad_group_criterion.listing_group.parent_ad_group_criterion,
        ad_group_criterion.listing_group.path,
        ad_group_criterion.listing_group.type
        FROM product_group_view
        WHERE ad_group_criterion.listing_group.type = 'UNIT'
        AND ad_group_criterion.listing_group.case_value.${caseValue} IS NULL
        AND ad_group_criterion.listing_group.parent_ad_group_criterion = '${
selectedNode?.listing_group?.parent_ad_group_criterion}'
        `;

with this line:  AND 
ad_group_criterion.listing_group.parent_ad_group_criterion = '${selectedNode
?.listing_group?.parent_ad_group_criterion}'

I get the one partition from my active tree that is already the "others 
node" for an already subdivided partition (done during creation).

when I remove the line targeting parent criterion, I am left with about 900 
partitions. So I am really interested in learning how this works. In terms 
of the data relationship and structure, how does one identify the "others" 
node of a specific partition when 1. the other's node does not currently 
exist in the current product_group_view where ad_group.id = ${adgroupId}?

my tree is like this for said ag_group > product_group_view:
I already have a brand node subdivided by product item id.
I now want to do the same the other unit node(**).
S = Subdivision
U = UNIT
** = convert UNIT to SUBDIVISION operation

                                                       all products(S)
                                                                |
                                   **brand(U) 
-------------------------brand (S)
                                                                |          
         |
                                                                |          
        item_id(U)
                                                                |          
          |
                                                      ev else (all)        
   ev else (brand1) (U)

Can you please confirm that i have to find the "other's node" and delete it 
despite it not existing in my current tree? 
2. I saw in your response that I should querying the ad_group_criterion 
resource? not the product_group_view? Is there a specific advantage using 
the ad_group_criterion in this case?

Kind Regards,
Michael H.

On Tuesday, February 20, 2024 at 3:26:43 AM UTC+7 Google Ads API Forum 
Advisor wrote:

> Hi,
>
> Thank you for reaching out to the Google Ads API support team.
>
> By reviewing your concern, I understand that you want to modify the 
> structure of the existing product_group_view for a specific ad group. I 
> agree that you need to change the node’s ListingGroupType 
> <https://developers.google.com/google-ads/api/reference/rpc/v15/ListingGroupTypeEnum.ListingGroupType>
>  
> from UNIT to SUBDIVISION in order to continue with the subdivision you want 
> to achieve.
>
> Please find the response to your queries respectively.
>
>
> *How can I correctly identify the "others" node when converting a UNIT to 
> a Subdivision?*
>
> Please refer to the ad_group_criterion 
> <https://developers.google.com/google-ads/api/fields/v15/ad_group_criterion> 
> resource to get the information on the nodes. 
>
>
> *I am getting an error that the 'everything else node' already exists. 
> This also flags that my subdivided node needs an "others case". Meanwhile 
> the node does get removed (haha), so I have to re-add it again .*
>
> I understand that you are converting your unit node to subdivision. From 
> the provided code snippet, I could see that the subdivision has only 
> everythingElse node. Please note that the subdivision must always be 
> completely partitioned, which must contain a node representing 'Other'. 
> Could you please try adding the 'Other' node to the subdivision.
>
>
> *Am I also expected to find the "everything else node" in the 
> product_group_view and delete it and how can I identify I am deleting the 
> correct "others" node?   *
>
> Please refer to the ad_group_criterion 
> <https://developers.google.com/google-ads/api/fields/v15/ad_group_criterion> 
> resource to get the information on the nodes.
>
> You may also refer to this code 
> <https://developers.google.com/google-ads/api/samples/add-shopping-product-listing-group-tree>,
>  if 
> you want to replace the existing listing group tree on an ad group.
>
> Hope this helps.
>   
> This message is in relation to case "ref:!00D1U01174p.!5004Q02rzEgV:ref"
>
> Thanks,
>   
> [image: Google Logo] Google Ads API Team 
>
>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/aae05994-115c-41a0-a58e-7e4a0168bb8dn%40googlegroups.com.
  • Re... Jebron Lames
    • ... Jebron Lames
      • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
        • ... Jebron Lames

Reply via email to