उपयोगकर्ता सूचियां

सभी उपयोगकर्ता सूचियां पुनः पाएं

function getAllUserLists() {
  const userLists = AdsApp.userlists().get();
  console.log(`${userLists.totalNumEntities()} user lists found.`);
  return userLists;
}

हर उपयोगकर्ता सूची में सदस्यों की संख्या लॉग करें

function logUserListMemberCount() {
  const userlists = AdsApp.userlists().get();
  for (const userlist of userlists) {
    console.log(`${userlist.getName()} has ${userlist.getSizeForSearch()} `
        + `members for Search campaigns and ${userlist.getSizeForDisplay()} `
        + `members for Display campaigns.`);
  }
}

कोई उपयोगकर्ता सूची खोलें

function openUserList(name) {
  const userlists = AdsApp.userlists()
      .withCondition(`user_list.name = '${name}'`)
      .get();
  if (userlists.totalNumEntities() == 0) {
    throw new Error(`No user list with name '${name}' found.`);
  }
  const userlist = userlists.next();
  userlist.open();
}

किसी उपयोगकर्ता सूची के ज़रिए लक्षित खोज कैंपेन को पुनः पाएं

function getSearchCampaignsTargetedByUserList(name) {
  const userlists = AdsApp.userlists()
      .withCondition(`user_list.name = '${name}'`)
      .get();
  if (userlists.totalNumEntities() == 0) {
    throw new Error(`No user list with name '${name}' found.`);
  }
  const userlist = userlists.next();
  const campaigns = userlist.targetedCampaigns().get();
  console.log(`Userlist '${name}' is targeting ${campaigns.totalNumEntities()} campaigns.`);
  return campaigns;
}