Comments (4)
@aleinv18 you can add up to 100 LocationCriterion per AddCampaignCriterions or AddAdGroupCriterions request. The maximum number of combined location and negative location criterions that you can specify per campaign or ad group is 10,000. Let's take AddCampaignCriterions as an example. You would create up to 100 BiddableCampaignCriterion objects, and each would contain a LocationCriterion. If you want to exclude any locations then use NegativeCampaignCriterion (instead of BiddableCampaignCriterion) that contains a LocationCriterion.
Please let me know if you have any follow up questions.
from advertising-docs.
hi @eric-urban,
thank you for your reply.
Ok, but at code level where i have to insert the array of location?
I would send an unique SOAP request with all locations included
Thank you
from advertising-docs.
@aleinv18 yes the result can be one SOAP request message. You can append BiddableCampaignCriterion objects to the array of campaign criteria. Here is a Python sample:
campaign_criterions=campaign_service.factory.create('ArrayOfCampaignCriterion')
us_campaign_location_criterion=set_elements_to_none(campaign_service.factory.create('BiddableCampaignCriterion'))
us_campaign_location_criterion.Type='BiddableCampaignCriterion'
us_campaign_location_criterion.CampaignId=campaign_ids['long'][0]
us_bid_multiplier=set_elements_to_none(campaign_service.factory.create('BidMultiplier'))
us_bid_multiplier.Type='BidMultiplier'
us_bid_multiplier.Multiplier=0
us_campaign_location_criterion.CriterionBid=us_bid_multiplier
us_location_criterion=set_elements_to_none(campaign_service.factory.create('LocationCriterion'))
us_location_criterion.Type='LocationCriterion'
# United States
us_location_criterion.LocationId=190
us_campaign_location_criterion.Criterion=us_location_criterion
campaign_criterions.CampaignCriterion.append(us_campaign_location_criterion)
canada_campaign_location_criterion=set_elements_to_none(campaign_service.factory.create('BiddableCampaignCriterion'))
canada_campaign_location_criterion.Type='BiddableCampaignCriterion'
canada_campaign_location_criterion.CampaignId=campaign_ids['long'][0]
canada_bid_multiplier=set_elements_to_none(campaign_service.factory.create('BidMultiplier'))
canada_bid_multiplier.Type='BidMultiplier'
canada_bid_multiplier.Multiplier=0
canada_campaign_location_criterion.CriterionBid=canada_bid_multiplier
canada_location_criterion=set_elements_to_none(campaign_service.factory.create('LocationCriterion'))
canada_location_criterion.Type='LocationCriterion'
# Canada
canada_location_criterion.LocationId=32
canada_campaign_location_criterion.Criterion=canada_location_criterion
campaign_criterions.CampaignCriterion.append(canada_campaign_location_criterion)
output_status_message("-----\nAddCampaignCriterions:")
add_campaign_criterions_response = campaign_service.AddCampaignCriterions(
CampaignCriterions=campaign_criterions,
CriterionType='Targets'
)
Here is the resulting SOAP request:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="https://bingads.microsoft.com/CampaignManagement/v13" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tns="https://bingads.microsoft.com/CampaignManagement/v13" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<tns:AuthenticationToken>YourAccessTokenGoesHere</tns:AuthenticationToken>
<tns:CustomerAccountId>YourAccountIdGoesHere</tns:CustomerAccountId>
<tns:CustomerId>YourCustomerIdGoesHere</tns:CustomerId>
<tns:DeveloperToken>YourDeveloperTokenGoesHere</tns:DeveloperToken>
</SOAP-ENV:Header>
<ns1:Body>
<ns0:AddCampaignCriterionsRequest>
<ns0:CampaignCriterions>
<ns0:CampaignCriterion xsi:type="ns0:BiddableCampaignCriterion">
<ns0:CampaignId>YourCampaignIdGoesHere</ns0:CampaignId>
<ns0:Criterion xsi:type="ns0:LocationCriterion">
<ns0:Type>LocationCriterion</ns0:Type>
<ns0:LocationId>190</ns0:LocationId>
</ns0:Criterion>
<ns0:Type>BiddableCampaignCriterion</ns0:Type>
<ns0:CriterionBid xsi:type="ns0:BidMultiplier">
<ns0:Type>BidMultiplier</ns0:Type>
<ns0:Multiplier>0</ns0:Multiplier>
</ns0:CriterionBid>
</ns0:CampaignCriterion>
<ns0:CampaignCriterion xsi:type="ns0:BiddableCampaignCriterion">
<ns0:CampaignId>YourCampaignIdGoesHere</ns0:CampaignId>
<ns0:Criterion xsi:type="ns0:LocationCriterion">
<ns0:Type>LocationCriterion</ns0:Type>
<ns0:LocationId>32</ns0:LocationId>
</ns0:Criterion>
<ns0:Type>BiddableCampaignCriterion</ns0:Type>
<ns0:CriterionBid xsi:type="ns0:BidMultiplier">
<ns0:Type>BidMultiplier</ns0:Type>
<ns0:Multiplier>0</ns0:Multiplier>
</ns0:CriterionBid>
</ns0:CampaignCriterion>
</ns0:CampaignCriterions>
<ns0:CriterionType>Targets</ns0:CriterionType>
</ns0:AddCampaignCriterionsRequest>
</ns1:Body>
</SOAP-ENV:Envelope>
I hope this helps!
from advertising-docs.
u are very kind. Thank you so much!
from advertising-docs.
Related Issues (20)
- Worst docs ever HOT 1
- How to use Sandbox in an environment like Jenkins HOT 1
- PowerShell script not working HOT 1
- Error: There was an error while trying to deserialize parameter. Bing Ads API V13 Python. HOT 3
- authenticating from serverless-worker system HOT 1
- How to include transaction.xsd and common_types.xsd when validate the xml? HOT 2
- Authentication failed on AddCampaigns HOT 3
- Bing Ads API - PHP
- CampaignPerformanceReport's mutually exclusive Impression Share Performance Statistics out-of-date (Bing Reports Overview Page) HOT 3
- Error on grant consent when following steps in document HOT 5
- Duplicate Report Column - cause error HOT 1
- Feedback: More examples HOT 3
- Missing download for enum values like currencies and minimum CPCs HOT 1
- Please provide direct download links, not just via the API HOT 1
- Getting Error code HOT 5
- 404 Script Error HOT 2
- Option 2 - How long should the access be valid for? HOT 1
- Script execution completed successfully, but it didn't. HOT 9
- Permissions HOT 1
- Negative Keywords report HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from advertising-docs.