Get Customer Labels Name

97 views
Skip to first unread message

Vladimir Hiuk

unread,
May 17, 2022, 5:06:10 AM5/17/22
to Google Ads API and AdWords API Forum
Hello,

I'm trying to get customer/account labels but don't know how. I've tried all the options I've found. Here is my last option:
I need this labels from Screen
2022-05-17_11-00.png

My Code:
$queryLabels3 = "SELECT customer_label.customer, customer_label.label, customer_label.resource_name, customer.id FROM customer_label";

/** @var GoogleAdsServerStreamDecorator $labelStream */
$labelStream = $googleAdsServiceClient->searchStream(4854014806, $queryLabels3);
foreach ($labelStream->iterateAllElements() as $googleAdsRowForLabels) {
/** @var GoogleAdsRow $googleAdsRowForLabels */ "customers/9144796124/labels/3439160676" // $queryLabels
var_dump($googleAdsRowForLabels->getCustomerLabel()->getLabel());
var_dump($googleAdsRowForLabels->getCustomerLabel()->getCustomer());
var_dump($googleAdsRowForLabels->getCustomerLabel()->getResourceName());
var_dump($customerId);
}

Result:
string(38) "customers/1138211281/labels/2504236680"
string(20) "customers/4854014806"
string(46) "customers/4854014806/customerLabels/2504236680"
int(8377105507)

How can I get the names of the labels, not their IDs? I also want to clarify that I do not need campaign labels, but account/customer labels

Google Ads API Forum Advisor

unread,
May 17, 2022, 10:26:19 AM5/17/22
to khi...@gmail.com, adwor...@googlegroups.com

Hi there,

Thanks for reaching out to the Google Ads API Forum.

You may need to perform a separate request for the label report after pulling customer_label.label from customer_label report in order to get the name of those labels.

Let us know if you have any further questions.

Regards,

Google Logo
Yasar
Google Ads API Team
 


ref:_00D1U1174p._5004Q2atTiK:ref
Message has been deleted

Vladimir Hiuk

unread,
May 18, 2022, 4:17:21 AM5/18/22
to Google Ads API and AdWords API Forum
Hi,

thanks, that helped, but there was another problem:

"SELECT customer_label.label FROM customer_label WHERE customer.id =  999999999";
"SELECT label.id, label.name, label.resource_name FROM label WHERE label.id IN (111111111б, 222222222)";

In the first request I get the IDs and in the second I get the labels. Everything works great, but for some reason requests with some identifiers return an empty string, although the label exists. This label was created recently and by another user in the ads.google.com UI, could this be the cause and how can it be resolved?

Best regards
Vladimir
вторник, 17 мая 2022 г. в 16:26:19 UTC+2, adsapi:

Vladimir Hiuk

unread,
May 18, 2022, 6:36:22 AM5/18/22
to Google Ads API and AdWords API Forum
Problem solved. The thing was that some labels were created in the sub account and therefore were not available from the top level account

среда, 18 мая 2022 г. в 10:17:21 UTC+2, Vladimir Hiuk:

Google Ads API Forum Advisor

unread,
May 19, 2022, 12:57:10 AM5/19/22
to khi...@gmail.com, adwor...@googlegroups.com
Hi Vladimir,

Thank you for providing updates to your concern.

So that we can further investigate the issue, would you be able to provide the complete request and response logs with request ID and request header generated on your end for all the issues with different scenarios?

You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


ref:_00D1U1174p._5004Q2atTiK:ref
Reply all
Reply to author
Forward
0 new messages