GetHistoricalKeywordPerformance Service Operation - Ad Insight

Gets the historical performance of the normalized search term. The results are aggregated by device type.

Request Elements

The GetHistoricalKeywordPerformanceRequest 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.

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 keyword performance data for the device types that you specify only, if available.
Used to determine a keyword's performance on the specified device types.
string array
Keywords An array of keywords for which you want to get historical performance statistics. 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.

Possible values include Danish, Dutch, English, Finnish, French, German, Italian, Norwegian, Portuguese, Spanish, Swedish, and TraditionalChinese.
MatchTypes The match types for which you want to get historical data.

You may not specify the Content match type.
MatchType array
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.

The following language and country/region combinations are supported:
Danish: DK
Dutch: NL
English: AU, CA, GB, ID, IN, MY, PH, SG, TH, US, VN
Finnish: FI
French: CA, FR
German: AT, CH, DE
Italian: IT
Norwegian: NO
Portuguese: BR
Spanish: AR, CL, CO, ES, MX, PE, VE
Swedish: SE
TraditionalChinese: HK, TW

If this element is null, then by default the service includes all countries/regions that support the specified language.
string array
TargetAdPosition The position of the search results for which you want to get performance data.

For example, to get performance data when ads appeared in the first position of the mainline by using the keyword and match type, set this element to MainLine1. To get performance data when ads appeared in any position of the search results by using the keyword and match type, set this element to All.

The default value is All.

If you specify All for this element, the service will return multiple results per keyword for each supported ad position. If you specify Aggregate, the service will return one aggregated result.

Sidebar ads no longer serve on Bing owned and operated sites in the United States. If you only request first page data e.g., FirstPage1 for the United States (US), then the KeywordKPIs element in the result will be nil/empty. If you include additional countries/regions e.g., US and CA in the same request, then any first page results are only attributed to countries/regions outside the United States.
TimeInterval The time period that identifies the data to use to determine the key performance index of the specified keywords. For example, use data from the previous seven days or previous 30 days to determine the keyword performance.

The default value is LastDay.

Request Header Elements

Element Description Data Type
AuthenticationToken The OAuth access token that represents a Microsoft Account user who has permissions to Bing Ads accounts. string
CustomerAccountId The identifier of the account that owns the entities in the request. This header element must have the same value as the AccountId body element when both are required. string
CustomerId The identifier of the customer that contains and owns the account. If you manage an account of another customer, you should use that customer ID instead of your own customer ID. string
DeveloperToken The developer token used to access the Bing Ads API. 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


The CustomerAccountId and CustomerId are required for most service operations, and as a best practice you should always specify them in the request.

Response Elements

The GetHistoricalKeywordPerformanceResponse 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
KeywordHistoricalPerformances An array of KeywordHistoricalPerformance data objects. The array contains an item for each keyword, device, match type, and ad position specified in the request. If the keyword is not valid or has no data available, the corresponding item in the array will be null. KeywordHistoricalPerformance 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="" xmlns:s="">
  <s:Header xmlns="Microsoft.Advertiser.AdInsight.Api.Service.V12">
    <Action mustUnderstand="1">GetHistoricalKeywordPerformance</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>
    <GetHistoricalKeywordPerformanceRequest xmlns="Microsoft.Advertiser.AdInsight.Api.Service.V12">
      <Keywords i:nil="false" xmlns:a1="">
      <TimeInterval i:nil="false">ValueHere</TimeInterval>
      <TargetAdPosition i:nil="false">ValueHere</TargetAdPosition>
      <MatchTypes i:nil="false">
      <Language i:nil="false">ValueHere</Language>
      <PublisherCountries i:nil="false" xmlns:a1="">
      <Devices i:nil="false" xmlns:a1="">

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="">
  <s:Header xmlns="Microsoft.Advertiser.AdInsight.Api.Service.V12">
    <TrackingId d3p1:nil="false" xmlns:d3p1="">ValueHere</TrackingId>
    <GetHistoricalKeywordPerformanceResponse xmlns="Microsoft.Advertiser.AdInsight.Api.Service.V12">
      <KeywordHistoricalPerformances xmlns:e92="" d4p1:nil="false" xmlns:d4p1="">
          <e92:Keyword d4p1:nil="false">ValueHere</e92:Keyword>
          <e92:KeywordKPIs d4p1:nil="false">
              <e92:Device d4p1:nil="false">ValueHere</e92:Device>

Code Syntax

The example syntax can be used with Bing Ads SDKs. See Bing Ads Code Examples for more examples.

public async Task<GetHistoricalKeywordPerformanceResponse> GetHistoricalKeywordPerformanceAsync(
	IList<string> keywords,
	TimeInterval? timeInterval,
	AdPosition? targetAdPosition,
	IList<MatchType> matchTypes,
	string language,
	IList<string> publisherCountries,
	IList<string> devices)
	var request = new GetHistoricalKeywordPerformanceRequest
		Keywords = keywords,
		TimeInterval = timeInterval,
		TargetAdPosition = targetAdPosition,
		MatchTypes = matchTypes,
		Language = language,
		PublisherCountries = publisherCountries,
		Devices = devices

	return (await AdInsightService.CallAsync((s, r) => s.GetHistoricalKeywordPerformanceAsync(r), request));
static GetHistoricalKeywordPerformanceResponse getHistoricalKeywordPerformance(
	ArrayOfstring keywords,
	TimeInterval timeInterval,
	AdPosition targetAdPosition,
	ArrayOfMatchType matchTypes,
	java.lang.String language,
	ArrayOfstring publisherCountries,
	ArrayOfstring devices) throws RemoteException, Exception
	GetHistoricalKeywordPerformanceRequest request = new GetHistoricalKeywordPerformanceRequest();


	return AdInsightService.getService().getHistoricalKeywordPerformance(request);
static function GetHistoricalKeywordPerformance(

	$GLOBALS['Proxy'] = $GLOBALS['AdInsightProxy'];

	$request = new GetHistoricalKeywordPerformanceRequest();

	$request->Keywords = $keywords;
	$request->TimeInterval = $timeInterval;
	$request->TargetAdPosition = $targetAdPosition;
	$request->MatchTypes = $matchTypes;
	$request->Language = $language;
	$request->PublisherCountries = $publisherCountries;
	$request->Devices = $devices;

	return $GLOBALS['AdInsightProxy']->GetService()->GetHistoricalKeywordPerformance($request);


Service: AdInsightService.svc v12
Namespace: Microsoft.Advertiser.AdInsight.Api.Service.V12