GetHistoricalSearchCount Service Operation - Ad Insight
Gets the number of times the normalized term was used in a search during the specified time period. The results are aggregated by device type.
Request Elements
The GetHistoricalSearchCountRequest object defines the body and header elements of the service operation request. The elements must be in the same order as shown in the Request SOAP.
Note
Unless otherwise noted below, all request elements are required.
Request Body Elements
Element | Description | Data Type |
---|---|---|
Devices | A list of one or more of the following device types: Computers, NonSmartphones, Smartphones, Tablets. The default is Computers. The response includes search counts for the device types that you specify only, if available. |
string array |
EndDate | The end date of the date range that identifies the data that you want to use to determine the historical search count. The date cannot be later than today's date, and must be later than or the same as the specified start date. The effective end date may be adjusted if the specified TimePeriodRollup is Weekly or Monthly. |
DayMonthAndYear |
Keywords | An array of keywords for which you want to determine the number of times that the keyword was used in a search query. The array can contain a maximum of 1,000 keywords, and each keyword can contain a maximum of 100 characters. | string array |
Language | The language in which the keywords are written. The countries/regions that you specify in the PublisherCountries element must support the specified language. For possible values, see Supported Languages. |
string |
PublisherCountries | The country codes of the countries/regions to use as the source of the historical data. You can specify one or more country codes. Each country/region that you specify must support the language specified in the Language element. For possible values, see Ad Languages. If Null, the default is all countries/regions that support the specified language. |
string array |
StartDate | The start date of the date range that identifies the data that you want to use to determine the historical search count. This date must be earlier than or the same as the specified end date. The date should be later than the maximum available historical data range corresponding to the specified TimePeriodRollup element. The effective start date may be adjusted if the specified TimePeriodRollup is Weekly or Monthly. |
DayMonthAndYear |
TimePeriodRollup | You may specify whether to return data aggregated daily, weekly, or monthly. For a list of supported values, see the Remarks section below. |
string |
Request Header Elements
Element | Description | Data Type |
---|---|---|
AuthenticationToken | The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts. For more information see Authentication with OAuth. |
string |
CustomerAccountId | The identifier of the ad account that owns or is associated with the entities in the request. This header element must have the same value as the AccountId body element when both are required. This element is required for most service operations, and as a best practice you should always set it. For more information see Get Your Account and Customer IDs. |
string |
CustomerId | The identifier of the manager account (customer) the user is accessing or operating from. A user can have access to multiple manager accounts. This element is required for most service operations, and as a best practice you should always set it. For more information see Get Your Account and Customer IDs. |
string |
DeveloperToken | The developer token used to access the Bing Ads API. For more information see Get a Developer Token. |
string |
Password | This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. | string |
UserName | This element is reserved for internal use and will be removed from a future version of the API. You must use the AuthenticationToken element to set user credentials. | string |
Response Elements
The GetHistoricalSearchCountResponse object defines the body and header elements of the service operation response. The elements are returned in the same order as shown in the Response SOAP.
Response Body Elements
Element | Description | Data Type |
---|---|---|
KeywordSearchCounts | An array of KeywordSearchCount data objects. The array contains an item for each keyword specified in the request. If the keyword is not valid, the corresponding item in the array will be null. Each KeywordSearchCount contains an array of SearchCountsByAttributes. The array contains an item for each unique device specified in the request. |
KeywordSearchCount array |
Response Header Elements
Element | Description | Data Type |
---|---|---|
TrackingId | The identifier of the log entry that contains the details of the API call. | string |
Request SOAP
This template was generated by a tool to show the order of the body and header elements for the SOAP request. For supported types that you can use with this service operation, see the Request Body Elements reference above.
<s:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns="https://bingads.microsoft.com/AdInsight/v13">
<Action mustUnderstand="1">GetHistoricalSearchCount</Action>
<AuthenticationToken i:nil="false">ValueHere</AuthenticationToken>
<CustomerAccountId i:nil="false">ValueHere</CustomerAccountId>
<CustomerId i:nil="false">ValueHere</CustomerId>
<DeveloperToken i:nil="false">ValueHere</DeveloperToken>
</s:Header>
<s:Body>
<GetHistoricalSearchCountRequest xmlns="https://bingads.microsoft.com/AdInsight/v13">
<Keywords i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:string>ValueHere</a1:string>
</Keywords>
<Language i:nil="false">ValueHere</Language>
<PublisherCountries i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:string>ValueHere</a1:string>
</PublisherCountries>
<StartDate i:nil="false">
<Day>ValueHere</Day>
<Month>ValueHere</Month>
<Year>ValueHere</Year>
</StartDate>
<EndDate i:nil="false">
<Day>ValueHere</Day>
<Month>ValueHere</Month>
<Year>ValueHere</Year>
</EndDate>
<TimePeriodRollup i:nil="false">ValueHere</TimePeriodRollup>
<Devices i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:string>ValueHere</a1:string>
</Devices>
</GetHistoricalSearchCountRequest>
</s:Body>
</s:Envelope>
Response SOAP
This template was generated by a tool to show the order of the body and header elements for the SOAP response.
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header xmlns="https://bingads.microsoft.com/AdInsight/v13">
<TrackingId d3p1:nil="false" xmlns:d3p1="http://www.w3.org/2001/XMLSchema-instance">ValueHere</TrackingId>
</s:Header>
<s:Body>
<GetHistoricalSearchCountResponse xmlns="https://bingads.microsoft.com/AdInsight/v13">
<KeywordSearchCounts d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
<KeywordSearchCount>
<Keyword d4p1:nil="false">ValueHere</Keyword>
<SearchCountsByAttributes d4p1:nil="false">
<SearchCountsByAttributes>
<Device d4p1:nil="false">ValueHere</Device>
<HistoricalSearchCounts d4p1:nil="false">
<HistoricalSearchCountPeriodic>
<SearchCount>ValueHere</SearchCount>
<DayMonthAndYear d4p1:nil="false">
<Day>ValueHere</Day>
<Month>ValueHere</Month>
<Year>ValueHere</Year>
</DayMonthAndYear>
</HistoricalSearchCountPeriodic>
</HistoricalSearchCounts>
</SearchCountsByAttributes>
</SearchCountsByAttributes>
</KeywordSearchCount>
</KeywordSearchCounts>
</GetHistoricalSearchCountResponse>
</s:Body>
</s:Envelope>
Code Syntax
The example syntax can be used with Bing Ads SDKs. See Bing Ads API Code Examples for more examples.
public async Task<GetHistoricalSearchCountResponse> GetHistoricalSearchCountAsync(
IList<string> keywords,
string language,
IList<string> publisherCountries,
DayMonthAndYear startDate,
DayMonthAndYear endDate,
string timePeriodRollup,
IList<string> devices)
{
var request = new GetHistoricalSearchCountRequest
{
Keywords = keywords,
Language = language,
PublisherCountries = publisherCountries,
StartDate = startDate,
EndDate = endDate,
TimePeriodRollup = timePeriodRollup,
Devices = devices
};
return (await AdInsightService.CallAsync((s, r) => s.GetHistoricalSearchCountAsync(r), request));
}
static GetHistoricalSearchCountResponse getHistoricalSearchCount(
ArrayOfstring keywords,
java.lang.String language,
ArrayOfstring publisherCountries,
DayMonthAndYear startDate,
DayMonthAndYear endDate,
java.lang.String timePeriodRollup,
ArrayOfstring devices) throws RemoteException, Exception
{
GetHistoricalSearchCountRequest request = new GetHistoricalSearchCountRequest();
request.setKeywords(keywords);
request.setLanguage(language);
request.setPublisherCountries(publisherCountries);
request.setStartDate(startDate);
request.setEndDate(endDate);
request.setTimePeriodRollup(timePeriodRollup);
request.setDevices(devices);
return AdInsightService.getService().getHistoricalSearchCount(request);
}
static function GetHistoricalSearchCount(
$keywords,
$language,
$publisherCountries,
$startDate,
$endDate,
$timePeriodRollup,
$devices)
{
$GLOBALS['Proxy'] = $GLOBALS['AdInsightProxy'];
$request = new GetHistoricalSearchCountRequest();
$request->Keywords = $keywords;
$request->Language = $language;
$request->PublisherCountries = $publisherCountries;
$request->StartDate = $startDate;
$request->EndDate = $endDate;
$request->TimePeriodRollup = $timePeriodRollup;
$request->Devices = $devices;
return $GLOBALS['AdInsightProxy']->GetService()->GetHistoricalSearchCount($request);
}
response=adinsight_service.GetHistoricalSearchCount(
Keywords=Keywords,
Language=Language,
PublisherCountries=PublisherCountries,
StartDate=StartDate,
EndDate=EndDate,
TimePeriodRollup=TimePeriodRollup,
Devices=Devices)
Remarks
The following case-sensitive values may be specified, and data will be returned as far back as the corresponding maximum available historical data range.
TimePeriodRollup | Available Historical Data |
---|---|
Daily | Up to 45 days prior to the most recent completed day. |
Weekly | Up to 15 weeks prior to the most recent completed week. The specified StartDate is adjusted back to the nearest Sunday, and the EndDate is adjusted forward to the nearest Saturday. |
Monthly | Up to 24 months prior to the most recent completed month. The specified StartDate is adjusted back to the beginning of the month, and the EndDate is adjusted forward to the end of the month. |
Supported Languages
Here are the supported languages for the Language request body element:
Supported Languages |
---|
Danish |
Dutch |
English |
Finnish |
French |
German |
Italian |
Norwegian |
Portuguese |
SimplifiedChinese |
Spanish |
Swedish |
TraditionalChinese |
Languages and Country/Region Mapping
Here is a table of languages and country/region mapping:
Language | CountryCode | Country/Region | Language@Country |
---|---|---|---|
Danish | DK | Denmark | Danish@Denmark |
Dutch | NL | Netherlands | Dutch@Netherlands |
English | AU | Australia | English@Australia |
English | CA | Canada | English@Canada |
English | FR | France | English@France |
English | DE | Germany | English@Germany |
English | IN | India | English@India |
English | ID | Indonesia | English@Indonesia |
English | IE | Ireland | English@Ireland |
English | IT | Italy | English@Italy |
English | MY | Malaysia | English@Malaysia |
English | NL | Netherlands | English@Netherlands |
English | NZ | NewZealand | English@NewZealand |
English | PH | Philippines | English@Philippines |
English | SG | Singapore | English@Singapore |
English | ES | Spain | English@Spain |
English | SE | Sweden | English@Sweden |
English | CH | Switzerland | English@Switzerland |
English | TH | Thailand | English@Thailand |
English | GB | United Kingdom | English@UK |
English | US | United States | English@US |
English | VN | Vietnam | English@Vietnam |
Finnish | FI | Finland | Finnish@Finland |
French | CA | Canada | French@Canada |
French | FR | France | French@France |
French | CH | Switzerland | French@Switzerland |
French | GB | United Kingdom | French@UK |
French | US | United States | French@US |
German | AU | Australia | German@Australia |
German | AT | Austria | German@Austria |
German | CA | Canada | German@Canada |
German | FR | France | German@France |
German | DE | Germany | German@Germany |
German | CH | Switzerland | German@Switzerland |
German | GB | United Kingdom | German@UK |
German | US | United States | German@US |
Italian | IT | Italy | Italian@Italy |
Norwegian | NO | Norway | Norwegian@Norway |
Portuguese | BR | Brazil | Portuguese@Brazil |
SimplifiedChinese | CN | China | SimplifiedChinese@China |
Spanish | AR | Argentina | Spanish@Argentina |
Spanish | CL | Chile | Spanish@Chile |
Spanish | CO | Colombia | Spanish@Colombia |
Spanish | MX | Mexico | Spanish@Mexico |
Spanish | PE | Peru | Spanish@Peru |
Spanish | ES | Spain | Spanish@Spain |
Spanish | US | US | Spanish@US |
Spanish | VE | Venezuela | Spanish@Venezuela |
Swedish | SE | Sweden | Swedish@Sweden |
TraditionalChinese | HK | HongKongSAR | TraditionalChinese@HongKongSAR |
TraditionalChinese | TW | Taiwan | TraditionalChinese@Taiwan |
Requirements
Service: AdInsightService.svc v13
Namespace: https://bingads.microsoft.com/AdInsight/v13