移动应用
    
    
      
    
    
      
      使用集合让一切井井有条
    
    
      
      根据您的偏好保存内容并对其进行分类。
    
  
    
  
      
    
  
  
  
  
  
    
    
    
  
  
    
    
    
创建附加移动应用信息
function createMobileApp() {
  // For full details on creating a new mobile app extension, see:
  // https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_mobileappbuilder
  const newMobileApp = AdsApp.extensions().newMobileAppBuilder()
      // See https://support.google.com/google-ads/answer/2402582 for details
      // on how to obtain applications specific store id
      .withAppId('INSERT_STORE_SPECIFIC_APP_ID_HERE')     // required
      // For iOS apps, use 'iOS' here
      .withStore('Android')                               // required
      // Replace the values below with your link text, final url, and start date
      .withLinkText('Download App Here')                  // required
      .withFinalUrl('http://www.example.com/androidApp')  // required
      .withStartDate({day : 29, month : 2, year : 2024})  // optional
      .build()
      .getResult();
  // Add mobile app to a campaign
  const campaignIterator = AdsApp.campaigns()
      .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"')
      .get();
  if (campaignIterator.hasNext()) {
    const campaign = campaignIterator.next();
    campaign.addMobileApp(newMobileApp);
  }
  // Add mobile app to an ad group
  const adGroupIterator = AdsApp.adGroups()
      .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"')
      .withCondition('ad_group.name = "INSERT_AD_GROUP_NAME_HERE"')
      .get();
  if (adGroupIterator.hasNext()) {
    const adGroup = adGroupIterator.next();
    adGroup.addMobileApp(newMobileApp);
  }
  // Add mobile app to an account
  const account = AdsApp.currentAccount();
  account.addMobileApp(newMobileApp);
}
记录广告系列的附加移动应用信息的详细信息
function logMobileAppDetails() {
  // Get a campaign.
  const campaignIterator = AdsApp.campaigns()
      .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"')
      .get();
  if (!campaignIterator.hasNext()) {
    throw new Error('Campaign not found.');
  }
  const campaign = campaignIterator.next();
  // Retrieve the campaign's mobile apps. Retrieving an ad group's and
  // account's mobile apps is similar.
  const mobileAppIterator = campaign.extensions().mobileApps().get();
  for (const mobileApp of mobileAppIterator) {
    // You can also request reports for pre-defined date ranges. See
    // https://developers.google.com/adwords/api/docs/guides/awql,
    // DateRangeLiteral section for possible values.
    const stats = mobileApp.getStatsFor('LAST_MONTH');
    console.log(`Mobile app id : ${ mobileApp.getAppId() }`);
    console.log(`link text : ${ mobileApp.getLinkText() }`);
    console.log(`final URL : ${ mobileApp.urls().getFinalUrl() }`);
    console.log(`clicks : ${ stats.getClicks() }`);
    console.log(`impressions : ${ stats.getImpressions() }`);
    console.log('=======');
  }
  console.log(`${mobileAppIterator.totalNumEntities()} mobile apps in the campaign`);
}
在广告系列中为移动应用设置投放时间
function setMobileAppSchedule() {
  // Get a campaign.
  const campaignIterator = AdsApp.campaigns()
      .withCondition('campaign.name = "INSERT_CAMPAIGN_NAME_HERE"')
      .get();
  if (!campaignIterator.hasNext()) {
    throw new Error('Campaign not found.');
  }
  const campaign = campaignIterator.next();
  // Retrieve the campaign's mobile apps. Retrieving an ad group's and
  // account's mobile apps is similar.
  const mobileAppIterator = campaign.extensions().mobileApps().get();
  for (const mobileApp of mobileAppIterator) {
    if (mobileApp.getAppId() === 'INSERT_STORE_SPECIFIC_APP_ID_HERE') {
      // Set mobile app schedule to run only on Mondays and Tuesdays, 9 AM to
      // 6 PM.
      const monday = {
        dayOfWeek: 'MONDAY',
        startHour: 9,
        startMinute: 0,
        endHour: 18,
        endMinute: 0
      };
      const tuesday = {
        dayOfWeek: 'TUESDAY',
        startHour: 9,
        startMinute: 0,
        endHour: 18,
        endMinute: 0
      };
      mobileApp.setSchedules([monday, tuesday]);
      break;
    }
  }
}
  
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
  最后更新时间 (UTC):2025-08-21。
  
  
  
    
      [[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-21。"],[],[]]