Hello,

I am trying to target a campaign on a particular device in a similar way 
targeting is done in this example:
https://developers.google.com/google-ads/api/docs/samples/add-campaign-targeting-criteria

I am able to target a campaign on a location using a similar approach to 
what is done in this example and in the code below.

However, I am getting the following error when trying to target a device:

errors {

 error_code {

   operator_error: OPERATOR_NOT_SUPPORTED

 }

 message: "Operator not supported."

 trigger {

   string_value: "CriterionId{id=30000}"

 }

 location {

   field_path_elements {

     field_name: "operations"

     index {

     }

   }

   field_path_elements {

     field_name: "create"

   }

   field_path_elements {

     field_name: "device"

   }

 }

}


Here is the api client library usage that is causing this error:

public String targetCampaignDevice(Long customerId, Long campaignId, 
DeviceEnum.Device device)
{
    GoogleAdsClient googleAdsClient = getGoogleAdsClient();

    String campaignResourceName = ResourceNames.campaign(customerId, 
campaignId);
    ArrayList<CampaignCriterionOperation> ops = new ArrayList<>();

    // Set device criteria
    CampaignCriterion.Builder criterionBuilder =
        CampaignCriterion.newBuilder()
            
.setCampaign(StringValue.newBuilder().setValue(campaignResourceName).build())
            .setDevice(DeviceInfo.newBuilder().setType(device).build());

    CampaignCriterion criterion = criterionBuilder.build();

    ops.add(CampaignCriterionOperation.newBuilder()
                .setCreate(criterion)
                .build());

    try (CampaignCriterionServiceClient campaignCriterionServiceClient =
        
googleAdsClient.getLatestVersion().createCampaignCriterionServiceClient()) {
        MutateCampaignCriteriaResponse response =
            campaignCriterionServiceClient.mutateCampaignCriteria(
                Long.toString(customerId), ops);
    }
    return campaignResourceName;
}


Device.Enum is imported from *com.google.ads.googleads.v1.enums.DeviceEnum*.


Any suggestions for this issue? Could someone provide an example of this 
being done correctly?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/479749f2-a116-4e8f-ae60-802ec64df624%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • Targeti... Ben Johnson
    • RE... googleadsapi-forumadvisor via AdWords API and Google Ads API Forum
      • ... Vinutha Nayak
    • RE... Google Ads API Forum Advisor Prod

Reply via email to