Struggling to pull RSA labels

19 views
Skip to first unread message

Geoff Procter

unread,
May 26, 2023, 8:31:46 AM5/26/23
to Google Ads Scripts Forum
Hi all,

I'm currently wrtiting a script to extract Responsive Search Ad details into Google Sheets, among the details I'm looking to pull are the labels attached to the Ads:

Screenshot 2023-05-25 114110.png

No matter how I try to pull the label details, I keep returning 0 results - so I must be doing something wrong.

function main(){
    var query =
    ' SELECT campaign.name, ad_group.name, ad_group_ad.labels, ad_group_ad.ad.id, ad_group_ad.ad_strength, ad_group_ad.ad.responsive_search_ad.headlines, ad_group_ad.ad.responsive_search_ad.descriptions FROM ad_group_ad WHERE ad_group_ad.ad.type=RESPONSIVE_SEARCH_AD AND ad_group_ad.status="ENABLED" ORDER BY campaign.name ASC, ad_group.name ASC';
 
  var rows = AdsApp.report(query).rows();
  while(rows.hasNext()){
    var row = rows.next();
   
    var subquery="SELECT label.name FROM ad_group_ad_label WHERE ad_group_ad.ad.id='"+row['ad_group_ad.ad.id']+"'";
    var subrows = AdsApp.report(subquery).rows();
    Logger.log(subrows.totalNumEntities());//RETURNS ZERO
   
    while(subrows.hasNext()){
      var subrow=subrows.next();
      Logger.log(subrow['label.name']);  
//LOOKING TO GET THE LABEL NAME HERE  
      }

   var headlines = row['ad_group_ad.ad.responsive_search_ad.headlines'];
    var headlineCount = headlines.length;
   
    var descriptions = row['ad_group_ad.ad.responsive_search_ad.descriptions'];
    var descriptionCount = descriptions.length;
   
    Logger.log(
      row['ad_group_ad.ad.id']+' | '+
      row['campaign.name']+' | '+
      row['ad_group.name']+' | '+
      headlineCount+' | '+
      descriptionCount
      );
    }
}

Even if I attempt to just pull labels alone, I'm getting nothing:

    var labelSelector = AdsApp.labels();
    var labelIterator = labelSelector.get();
    Logger.log(labelIterator.totalNumEntities());//RETURNS 0

Any help would be greatly appreciated,

Cheers,

Geoff

 

Google Ads Scripts Forum Advisor

unread,
May 26, 2023, 2:24:04 PM5/26/23
to adwords...@googlegroups.com

Hi Geoff,

I'm from the Google Ads Scripts team.

It appears that you have already opened a similar issue in this forum thread (https://groups.google.com/g/adwords-scripts/c/Jt0gHk0ZtXY/m/9W6FLzhNAAAJ?utm_medium=email&utm_source=footer). Can you please confirm if the issue raised in both threads are indeed the same? If yes, then let's continue the discussion on that thread moving forward so we can better track the issue. Also, please refrain from opening multiple threads for the same issue. Otherwise, if the issues are not the same, can you further elaborate the issue in this thread so we can further investigate?
 

This message is in relation to case "ref:_00D1U1174p._5004Q2ltd4d:ref"

Thanks,
 
Google Logo Google Ads Scripts Team


Geoff Procter

unread,
May 26, 2023, 2:40:46 PM5/26/23
to Google Ads Scripts Forum
My apologies - this is a duplicate. When posting the notification that it will be reviewed first only flashes up for a few seconds, and I could not see anywhere else suggesting that the post was received but being reviewed, so I assumed it had not been posted and re did it. This one can be closed.
Reply all
Reply to author
Forward
0 new messages