I can't get Responsive Search Ads Headlines and Descriptions

54 views
Skip to first unread message

ma...@sumer.me

unread,
Jul 18, 2022, 4:49:43 AM7/18/22
to Google Ads API and AdWords API Forum
Hi,

I am using PHP Client Library. I get every metric, resource etc. except responsive search ads headlines and descriptions.

When i run this code sample i get an error like this:

print_r($googleAdsRow->getAdGroupAd()->getAd()->getResponsiveSearchAd()->getHeadlines());

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 58724352 bytes)...

How can i get all texts?

Note: I tried upgrade memory and try sample code like this:


$responsiveSearchAdInfo = $ad->getResponsiveSearchAd();

printf(

'Headlines:%1$s%2$sDescriptions:%1$s%3$s%1$s',

PHP_EOL,

self::convertAdTextAssetsToString($responsiveSearchAdInfo->getHeadlines()),

self::convertAdTextAssetsToString($responsiveSearchAdInfo->getDescriptions())

);

Google Ads API Forum Advisor

unread,
Jul 18, 2022, 7:19:56 AM7/18/22
to ma...@sumer.me, adwor...@googlegroups.com
Hi Mahir,

Thank you for raising this concern to the Google Ads API support team.

With regard to your concern, you can use this code as reference in Google Ads API. However, if the issue is still persisting I would suggest you reach out to the author of the PHP client library to get help here. You can reach out to them via the PHP issues tracker on github to get further assistance here as they are more equipped for this matter.

Best regards,
Google Logo
Jinky
Google Ads API Team
 


ref:_00D1U1174p._5004Q2cX3bf:ref

ma...@sumer.me

unread,
Jul 18, 2022, 7:22:44 AM7/18/22
to Google Ads API and AdWords API Forum
Thanks for your help. I solved like this:

$ad = $googleAdsRow->getAdGroupAd()->getAd();
$responsiveSearchAdInfo = $ad->getResponsiveSearchAd();
           
$assets_headlines = $responsiveSearchAdInfo->getHeadlines();

foreach($assets_headlines as $asset){
        echo $asset->getText();

Google Ads API Forum Advisor

unread,
Jul 18, 2022, 7:23:53 AM7/18/22
to adwor...@googlegroups.com, ma...@sumer.me
Hi Mahir,

Thank you for raising this concern to the Google Ads API Forum.
Reply all
Reply to author
Forward
0 new messages