Campaign priority, inventory filter & Item id in AdGroups

187 views
Skip to first unread message

Avkeren Cohen

unread,
Jan 24, 2017, 9:25:25 AM1/24/17
to AdWords API Forum

Hi,

Before I start working with the AdWords API I will be happy to know the following:
  1. How can I get the Campaign priority?
  2. How can I get the inventory filter used in the shopping campaign settings? I did see there is an option to use ProductScope to create the campaign. Is there an option to get the ProductScope of a campaign already created? 
  3. How can I get the item id of all products that are under an AdGroup?
Thanks ...

Vishal Vinayak (Adwords API Team)

unread,
Jan 24, 2017, 4:01:11 PM1/24/17
to AdWords API Forum
Hi,

Please find my answers inline:

How can I get the Campaign priority?
  • Using CampaignService to fetch the shopping campaign, add the CampaignField.Settings in the selector. Then similar to GetCampaigns example, iterate through the list of campaigns to retrieve the ShoppingSetting of the desired campaign. From the ShoppingSetting object, you can retrieve the campaign priority that was set during the time of campaign creation. The code for the same is as follows:
do {
      // Get all campaigns.
      page = campaignService.get(selector);
      // Display campaigns.
      if (page.getEntries() != null) {
        for (Campaign campaign : page.getEntries()) {
          System.out.printf("Campaign with name '%s' and ID %d was found with type %s %s.%n", campaign.getName(),
              campaign.getId(), campaign.getAdvertisingChannelType(), campaign.getAdvertisingChannelSubType());
           if(campaign.getAdvertisingChannelType().toString().equalsIgnoreCase("SHOPPING")) {
           Setting[] setting= campaign.getSettings();
           for(int i=0;i<setting.length;i++){
           System.out.println("Setting Type: "+ setting[i].getSettingType());
           if (setting[i].getSettingType().toString().equalsIgnoreCase("ShoppingSetting")){
           ShoppingSetting shoppingsetting=(ShoppingSetting) setting[i];
           System.out.println("Campaign Priority: "+shoppingsetting.getCampaignPriority());
           }
           }
           }
        }
      } else {
        System.out.println("No campaigns were found.");
      }
      offset += PAGE_SIZE;
      selector = builder.increaseOffsetBy(PAGE_SIZE).build();
    } while (offset < page.getTotalNumEntries());

  • You can also optionally use a predicate to filter on the required campaign as follows:
            Predicate predicate = new Predicate();
            predicate.setField("CampaignId");
            predicate.setOperator(PredicateOperator.IN);
            predicate.setValues(new String[]{"123456789"});
            selector.setPredicates(new Predicate[] {predicate});

How can I get the inventory filter used in the shopping campaign settings? I did see there is an option to use ProductScope to create the campaign. Is there an option to get the ProductScope of a campaign already created? 

How can I get the item id of all products that are under an AdGroup?

Regards,
Vishal, AdWords API Team

Avkeren Cohen

unread,
Jan 27, 2017, 3:20:52 AM1/27/17
to AdWords API Forum
Hi Vishal,

Thanks for the reply.
Regarding question number 3, Will I be able from Shopping Performance Report see also items with 0 impressions? (new items added to the merchant center or items with low priority that are blocked with by the same item in high priority)

Thanks

Vishal Vinayak (Adwords API Team)

unread,
Jan 27, 2017, 1:37:53 PM1/27/17
to AdWords API Forum
Hi Avkeren,

Unfortunately, OfferId field (on which data is aggregated in the Shopping Performance Report) does not support zero impressions.
Reply all
Reply to author
Forward
0 new messages