Targeting a hotel campaign by device.

108 views
Skip to first unread message

Ben Johnson

unread,
May 15, 2019, 5:43:03 PM5/15/19
to AdWords API and Google Ads API Forum
Hello,

I am trying to target a campaign on a particular device in a similar way targeting is done in this example:

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?

googleadsapi...@google.com

unread,
May 16, 2019, 3:42:28 AM5/16/19
to AdWords API and Google Ads API Forum
Hi Ben,

Thank you for reaching out. To further investigate this, could you provide the complete JSON request and response logs when you encountered the error? If you haven't enabled logging yet, you could refer to the README section of your client library for detailed instructions on how to enable it. Please use the reply privately to author option.

Regards,
Dave
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
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 adwords-api+unsubscribe@googlegroups.com.
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.

Vinutha Nayak

unread,
May 21, 2019, 12:17:40 PM5/21/19
to AdWords API and Google Ads API Forum
I am seeing similar issue .  Is this solved ? If yes, could you please let me know how ?

Google Ads API Forum Advisor Prod

unread,
May 21, 2019, 11:47:22 PM5/21/19
to adwor...@googlegroups.com

Hi Vinutha,

Issue hasn't been resolved yet. To further investigate this, could you provide the complete JSON request and response logs when you encountered the error? If you haven't enabled logging yet, you could refer to the README section of your client library for detailed instructions on how to enable it. Please use the reply privately to authoroption.



Regards,
Dave
Google Ads API Team



ref:_00D1U1174p._5001UAqFMZ:ref

alok

unread,
Aug 30, 2019, 5:58:21 AM8/30/19
to AdWords API and Google Ads API Forum
 Hi,

 Is this resolved?? I am still facing the same issue while targeting device type.(using same approach as above)
 Any examples on how to target devices??

Thanks,
Alok
Reply all
Reply to author
Forward
0 new messages