In Code Examples, everything starts with AdsApp.

67 views
Skip to first unread message

Aaron Kempf

unread,
Jul 23, 2021, 10:47:42 AM7/23/21
to AdWords API and Google Ads API Forum
in this code example, I don't understand what the AdsApp object refers to
how do I ad AdsApp to my code? How do I find out the object model of 'AdsApp' object?

Thanks

-Aaron
-------------------------------------------------------------------------------
function addImageAd() {
 
// If you have multiple adGroups with the same name, this snippet will
 
// pick an arbitrary matching ad group each time. In such cases, just
 
// filter on the campaign name as well:
 
//
 
// AdsApp.adGroups()
 
//     .withCondition('Name = "INSERT_ADGROUP_NAME_HERE"')
 
//     .withCondition('CampaignName = "INSERT_CAMPAIGN_NAME_HERE"')
 
var adGroupIterator = AdsApp.adGroups()
     
.withCondition('Name = "INSERT_ADGROUP_NAME_HERE"')
     
.get();
 
var mediaIterator = AdsApp.adMedia().media()
     
.withCondition('Name = "INSERT_IMAGE_NAME_HERE"')
     
.get();
 
if (adGroupIterator.hasNext() && mediaIterator.hasNext()) {
   
var adGroup = adGroupIterator.next();
   
var image = mediaIterator.next();
    adGroup
.newAd().imageAdBuilder()
       
.withName('Ad name')
       
.withImage(image)
       
.withDisplayUrl('http://www.example.com')
       
.withFinalUrl('http://www.example.com')
       
.build();
   
// ImageAdBuilder has additional options.
   
// For more details, see
   
// https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_imageadbuilder
 
}
}

Google Ads API Forum Advisor

unread,
Jul 26, 2021, 4:49:37 PM7/26/21
to aarons...@gmail.com, adwor...@googlegroups.com
Hi,

Please post Google Ads Scripts concern in Ads Scripts forum: https://groups.google.com/g/adwords-scripts
Feel free to contact us for Google Ads API specific issues or concerns.

Thanks,

Google Logo
Lakshmi Prathipati
Google Ads API Team
 


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