Re: How to change Ad Group Audience List targeting from Observation to Targeting?

2019-05-09 Thread Josh Barr
Hi Bharani, thank you for responding! Setting 
userListsSetting.setTargetAll(false); changed it for me: 

public void updateTargeting(AdWordsServicesInterface adWordsServices, 
AdWordsSession session, AdGroup adGroup) {
 
 AdGroupServiceInterface adGroupService = adWordsServices.get(session, 
AdGroupServiceInterface.class);
 List settings = Lists.newArrayList();
 List details = Lists.newArrayList();
 TargetingSetting targetingSetting = null;
 if (adGroup.getSettings() != null) {
   // Find the existing TargetingSetting if it exists, and keep
   // track of all other settings.
   for (Setting setting : adGroup.getSettings()) {
 if (setting instanceof TargetingSetting) {
   targetingSetting = (TargetingSetting) setting;
 } else {
   settings.add(setting);
 }
   }


   if (targetingSetting != null) {
 // Copy all the existing TargetingSettingDetails except the one for
 // USER_INTEREST_AND_LIST.
 for (TargetingSettingDetail settingDetail : targetingSetting.getDetails
()) {
   if (!CriterionTypeGroup.USER_INTEREST_AND_LIST.equals(
   settingDetail.getCriterionTypeGroup())) {
 details.add(settingDetail);
   }
 }
   }
 }


 if (targetingSetting == null) {
   targetingSetting = new TargetingSetting();
 }


 // Create a new USER_INTEREST_AND_LIST targeting setting detail and add
 // it to the details list.
 TargetingSettingDetail userListsSetting = new TargetingSettingDetail();
 userListsSetting.setCriterionTypeGroup(CriterionTypeGroup.
USER_INTEREST_AND_LIST);


 // true = "Bid only"; false = "Target and bid"
 userListsSetting.setTargetAll(false);
 details.add(userListsSetting);


 targetingSetting.setDetails(details.toArray(new TargetingSettingDetail[
details.size()]));


 // Add the new TargetingSetting for USER_INTEREST_AND_LIST to the settings 
list.
 settings.add(targetingSetting);


 adGroup.setSettings(settings.toArray(new Setting[settings.size()]));
 
 // Create operations
 AdGroupOperation operation = new AdGroupOperation();
 operation.setOperand(adGroup);
 operation.setOperator(Operator.SET);
 
 AdGroupOperation[] operations = new AdGroupOperation[] {operation};
 
 // Update settings by sending operations
 try {
 AdGroupReturnValue result = adGroupService.mutate(operations);
 } catch (RemoteException e) {
 logger.error("Error updating ad group settings: " + e);
 }
 
 }


On Thursday, May 9, 2019 at 3:12:41 PM UTC-5, googleadsapi-forumadvisor 
wrote:
>
> Hi Josh, 
>
> You may use the AdGroupService.mutate() operation with the 
> TargetingSettingDetail 
> 
>  and 
> targetAll set to true/false to switch between Observation and Targeting. 
> You may refer to the code snippets available here 
> 
>  as 
> a reference. Could you please give this a try?
>
> Thanks,
> Bharani, 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/
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@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/52807871-fb5c-4c2c-9715-3e2a35bcc666%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to change Ad Group Audience List targeting from Observation to Targeting?

2019-05-09 Thread Josh Barr
Hi Bharani,

Thank you for the response! I just tested with this code and if my operator 
is "ADD" I get a duplicate adgroup name error, and if my operator is "SET" 
I don't get an error, but it's still set to Observation, and not Targeting.

public void updateTargeting(AdWordsServicesInterface adWordsServices, 
AdWordsSession session, AdGroup adGroup) {
 
 AdGroupServiceInterface adGroupService = adWordsServices.get(session, 
AdGroupServiceInterface.class);
 List settings = Lists.newArrayList();
 List details = Lists.newArrayList();
 TargetingSetting targetingSetting = null;
 if (adGroup.getSettings() != null) {
   // Find the existing TargetingSetting if it exists, and keep
   // track of all other settings.
   for (Setting setting : adGroup.getSettings()) {
 if (setting instanceof TargetingSetting) {
   targetingSetting = (TargetingSetting) setting;
 } else {
   settings.add(setting);
 }
   }


   if (targetingSetting != null) {
 // Copy all the existing TargetingSettingDetails except the one for
 // USER_INTEREST_AND_LIST.
 for (TargetingSettingDetail settingDetail : targetingSetting.getDetails
()) {
   if (!CriterionTypeGroup.USER_INTEREST_AND_LIST.equals(
   settingDetail.getCriterionTypeGroup())) {
 details.add(settingDetail);
   }
 }
   }
 }


 if (targetingSetting == null) {
   targetingSetting = new TargetingSetting();
 }


 // Create a new USER_INTEREST_AND_LIST targeting setting detail and add
 // it to the details list.
 TargetingSettingDetail userListsSetting = new TargetingSettingDetail();
 userListsSetting.setCriterionTypeGroup(CriterionTypeGroup.
USER_INTEREST_AND_LIST);


 // true = "Bid only"; false = "Target and bid"
 userListsSetting.setTargetAll(true);
 details.add(userListsSetting);


 targetingSetting.setDetails(details.toArray(new TargetingSettingDetail[
details.size()]));


 // Add the new TargetingSetting for USER_INTEREST_AND_LIST to the settings 
list.
 settings.add(targetingSetting);


 adGroup.setSettings(settings.toArray(new Setting[settings.size()]));
 
 // Create operations
 AdGroupOperation operation = new AdGroupOperation();
 operation.setOperand(adGroup);
 operation.setOperator(Operator.SET);
 
 AdGroupOperation[] operations = new AdGroupOperation[] {operation};
 
 // Update settings by sending operations
 try {
 AdGroupReturnValue result = adGroupService.mutate(operations);
 } catch (RemoteException e) {
 logger.error("Error updating ad group settings: " + e);
 }
 
 }


On Thursday, May 9, 2019 at 3:12:41 PM UTC-5, googleadsapi-forumadvisor 
wrote:
>
> Hi Josh, 
>
> You may use the AdGroupService.mutate() operation with the 
> TargetingSettingDetail 
> 
>  and 
> targetAll set to true/false to switch between Observation and Targeting. 
> You may refer to the code snippets available here 
> 
>  as 
> a reference. Could you please give this a try?
>
> Thanks,
> Bharani, 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/
> =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@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/e17ec976-53a7-4424-a823-74ea9711dff5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to change Ad Group Audience List targeting from Observation to Targeting?

2019-05-09 Thread Josh Barr
I have a little app to remove current audience lists from Ad Groups and add 
the one I want, but I can't figure out how to update the Targeting Setting 
from Observation to Targeting. Anyone know how to do that?

This is what I have to add a new Audience List to an Ad Group: 


   
 // create user list criterion. Set eligible makes it target
 CriterionUserList userListCriterion = new CriterionUserList();
 Long userListId = L;
 userListCriterion.setUserListId(userListId);
 userListCriterion.setUserListEligibleForSearch(true);


 // Create ad group criterion
 BiddableAdGroupCriterion adgroupCriterion = new BiddableAdGroupCriterion();
 adgroupCriterion.setAdGroupId(L);
 adgroupCriterion.setCriterion(userListCriterion);


 // Create operation
 AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
 operation.setOperand(adgroupCriterion);
 operation.setOperator(Operator.ADD);


 AdGroupCriterionOperation[] operations = new AdGroupCriterionOperation[] {
operation};


 // Apply the criterion
 AdGroupCriterionReturnValue result = adgroupCriterionService.mutate(
operations);

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@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/087dbdbd-b00f-4878-97b2-c9c73cfa2dae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Where to find Products Active field for Product Groups? I'm pulling a Product Partition Report and would like that column as well. Its in the UI.

2019-01-07 Thread josh . barr
Hi Peter, 

This is the screenshot. it's called Products Active and I can't find that 
in any reports currently available.

[image: 2019-01-07_13-45-20.png]

On Monday, January 7, 2019 at 1:06:55 AM UTC-6, Peter Oliquino (AdWords API 
Team) wrote:
>
> Hi Josh,
>
> Can you provide your clientCustomerID and the Google Ads UI screenshot 
> which shows the Products Active column so I can further check if it's 
> available via API?
>
> Thanks,
> Peter
> AdWords API Team
>
> On Saturday, January 5, 2019 at 5:20:08 AM UTC+8, josh...@uline.com 
>  wrote:
>>
>> Hi,
>>
>> I'm building a basic shopping campaign health report and would like to 
>> get the Products Active column for Product Groups that's available in the 
>> UI, I just can't find it anywhere.
>>
>>
>> Thanks,
>> Josh
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@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/1b3deb6e-50d9-40e1-956e-5390664f8519%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Where to find Products Active field for Product Groups? I'm pulling a Product Partition Report and would like that column as well. Its in the UI.

2019-01-04 Thread josh . barr
Hi,

I'm building a basic shopping campaign health report and would like to get 
the Products Active column for Product Groups that's available in the UI, I 
just can't find it anywhere.


Thanks,
Josh

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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+unsubscr...@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/8e1ab8f3-08f0-4c1c-b4f9-0f8f19a99386%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to get account data by channel (search, shopping, display, etc.), device, and date?

2017-09-19 Thread josh . barr
Account Performance Report can't segment by channel, and Campaign 
Performance Report I'd have to some how roll up to day totals. So far it 
outputs a line per campaign even when I don't include campaign in the 
report AWQL.

Is there a way to do this without having to write code to weight total 
stats per day, like avg position and impression share?

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@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 Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@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/07c2f57b-2903-4c5a-983c-40f39c08b206%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.