try to use .expandedTextAdBuilder and get error

20 views
Skip to first unread message

ads.a...@gmail.com

unread,
Nov 2, 2022, 3:42:22 AM11/2/22
to Google Ads Scripts Forum
when I try to run this function I get error: "Cannot create already deprecated ads"

What changes do I need to make?

// create ad function
function CreateAd(adGroup, header1, header2, description, partURL1, partURL2, destinationURL){
  Logger.log('url: %s', destinationURL);
 
  var operation = adGroup.newAd().expandedTextAdBuilder()
    .withHeadlinePart1(header1) // 30 characters
    .withHeadlinePart2(header2) // 30 characters
    .withDescription(description) // 80 characters
    .withPath1(partURL1) // 15 characters
    .withPath2(partURL2) // 15 characters
    .withFinalUrl(destinationURL) // 255 characters
    .build();
   
  if(!operation.isSuccessful())
    return null;
  return operation.getResult();
}

Nils Rooijmans

unread,
Nov 2, 2022, 4:04:06 AM11/2/22
to Google Ads Scripts Forum
you are trying to build an ETA ad, and this ad type has been deprecated.
instead, you should try and build a RSA ad:

// create ad function
function CreateAd(adGroup, header1, header2, description, partURL1, partURL2, destinationURL){
  Logger.log('url: %s', destinationURL);
 
 var operation = adGroup.newAd().responsiveSearchAdBuilder()
   .addHeadline(header1)
   .addHeadline(header2)
   .addHeadline(header3)
   .addDescription(description1)
   .addDescription(description2)
   .withPath1(partURL1)
   .withPath2(partURL2)
   .withFinalUrl(destinationURL)
   .build();

   
  if(!operation.isSuccessful())
    return null;
  return operation.getResult();
}


Hope this helps,

Nils Rooijmans
https://nilsrooijmans.com
See my Google Ads Scripts FAQ to avoid the same mistakes I made: https://nilsrooijmans.com/google-ads-scripts-faq/
Reply all
Reply to author
Forward
0 new messages