googleads / google-ads-php

Google Ads API Client Library for PHP
https://developers.google.com/google-ads/api/docs/client-libs/php
Apache License 2.0
295 stars 262 forks source link

Alternative to parseName #1042

Closed chiragvels closed 2 months ago

chiragvels commented 2 months ago

[DO NOT INCLUDE ANY PERSONAL OR SENSITIVE DATA - MAKE SURE TO REDACT CONTENT WHEN NECESSARY]

Your question:

Since the get method and any services that exclusively had a get method have been removed from Google Ads Library, Is there any alternative method to get Ids from resourceName?

I am using this by manipulating the string, but in this case we need to check all resource name. For example for keyword Resource name to get criteria ID

$parts = explode('~', $resourceName);
$criteriaId = end($parts);

I was using like this till v15 of the API.

AdGroupCriterionServiceClient::parseName($click_view->getKeyword())['criterion_id']

Thanks,

fiboknacky commented 2 months ago

Could this method be usable for your use case?

chiragvels commented 2 months ago

Hi @fiboknacky ,

Yes, This will helpful.

Thanks,