Edit

Share via


GetKeywordTrafficEstimates Service Operation - Ad Insight

Provides traffic estimates for keywords e.g., average CPC, average position, clicks, CTR, impressions, and total cost. As input you provide the bid, language, location, and network, with optional campaign budget and negative keyword filters.

Tip

For an overview, see the Keyword Ideas and Traffic Estimates technical guide.

Request Elements

The GetKeywordTrafficEstimatesRequest 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
CampaignEstimators Defines your campaign, ad group, and keyword level criteria and filters for the requested keyword traffic estimates. CampaignEstimator array

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 GetKeywordTrafficEstimatesResponse 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
CampaignEstimates The list of campaign estimates. Within each campaign estimate is a nested list of keyword traffic estimates for each ad group.

You can inspect the BatchError Details element to find out which of the requested list items failed. For example if Details contains "CampaignEstimators[0], AdGroupEstimators[1], KeywordEstimators is null or contains no value", the error occurred for the 2nd AdGroupEstimator in the submitted list. The Index element of the BatchError is only a sequential count of returned batch errors, and cannot be used to determine where in the request the error occurred.
CampaignEstimate 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">GetKeywordTrafficEstimates</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>
    <GetKeywordTrafficEstimatesRequest xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <CampaignEstimators i:nil="false">
        <CampaignEstimator>
          <AdGroupEstimators i:nil="false">
            <AdGroupEstimator>
              <AdGroupId i:nil="false">ValueHere</AdGroupId>
              <KeywordEstimators i:nil="false">
                <KeywordEstimator>
                  <Keyword i:nil="false">
                    <Id i:nil="false">ValueHere</Id>
                    <MatchType>ValueHere</MatchType>
                    <Text i:nil="false">ValueHere</Text>
                  </Keyword>
                  <MaxCpc i:nil="false">ValueHere</MaxCpc>
                </KeywordEstimator>
              </KeywordEstimators>
              <MaxCpc>ValueHere</MaxCpc>
            </AdGroupEstimator>
          </AdGroupEstimators>
          <CampaignId i:nil="false">ValueHere</CampaignId>
          <Criteria i:nil="false">
            <Criterion i:type="-- derived type specified here with the appropriate prefix --">
              <!--This field is applicable if the derived type attribute is set to LocationCriterion-->
              <LocationId>ValueHere</LocationId>
              <!--This field is applicable if the derived type attribute is set to LanguageCriterion-->
              <Language i:nil="false">ValueHere</Language>
              <!--This field is applicable if the derived type attribute is set to NetworkCriterion-->
              <Network>ValueHere</Network>
              <!--This field is applicable if the derived type attribute is set to DeviceCriterion-->
              <DeviceName i:nil="false">ValueHere</DeviceName>
            </Criterion>
          </Criteria>
          <DailyBudget i:nil="false">ValueHere</DailyBudget>
          <NegativeKeywords i:nil="false">
            <NegativeKeyword>
              <Id i:nil="false">ValueHere</Id>
              <MatchType>ValueHere</MatchType>
              <Text i:nil="false">ValueHere</Text>
            </NegativeKeyword>
          </NegativeKeywords>
        </CampaignEstimator>
      </CampaignEstimators>
    </GetKeywordTrafficEstimatesRequest>
  </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>
    <GetKeywordTrafficEstimatesResponse xmlns="https://bingads.microsoft.com/AdInsight/v13">
      <CampaignEstimates d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
        <CampaignEstimate>
          <AdGroupEstimates d4p1:nil="false">
            <AdGroupEstimate>
              <AdGroupId d4p1:nil="false">ValueHere</AdGroupId>
              <KeywordEstimates d4p1:nil="false">
                <KeywordEstimate>
                  <Keyword d4p1:nil="false">
                    <Id d4p1:nil="false">ValueHere</Id>
                    <MatchType>ValueHere</MatchType>
                    <Text d4p1:nil="false">ValueHere</Text>
                  </Keyword>
                  <Maximum d4p1:nil="false">
                    <AverageCpc>ValueHere</AverageCpc>
                    <AveragePosition>ValueHere</AveragePosition>
                    <Clicks>ValueHere</Clicks>
                    <Ctr>ValueHere</Ctr>
                    <Impressions>ValueHere</Impressions>
                    <TotalCost>ValueHere</TotalCost>
                  </Maximum>
                  <Minimum d4p1:nil="false">
                    <AverageCpc>ValueHere</AverageCpc>
                    <AveragePosition>ValueHere</AveragePosition>
                    <Clicks>ValueHere</Clicks>
                    <Ctr>ValueHere</Ctr>
                    <Impressions>ValueHere</Impressions>
                    <TotalCost>ValueHere</TotalCost>
                  </Minimum>
                </KeywordEstimate>
              </KeywordEstimates>
            </AdGroupEstimate>
          </AdGroupEstimates>
          <CampaignId d4p1:nil="false">ValueHere</CampaignId>
        </CampaignEstimate>
      </CampaignEstimates>
    </GetKeywordTrafficEstimatesResponse>
  </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<GetKeywordTrafficEstimatesResponse> GetKeywordTrafficEstimatesAsync(
	IList<CampaignEstimator> campaignEstimators)
{
	var request = new GetKeywordTrafficEstimatesRequest
	{
		CampaignEstimators = campaignEstimators
	};

	return (await AdInsightService.CallAsync((s, r) => s.GetKeywordTrafficEstimatesAsync(r), request));
}
static GetKeywordTrafficEstimatesResponse getKeywordTrafficEstimates(
	ArrayOfCampaignEstimator campaignEstimators) throws RemoteException, Exception
{
	GetKeywordTrafficEstimatesRequest request = new GetKeywordTrafficEstimatesRequest();

	request.setCampaignEstimators(campaignEstimators);

	return AdInsightService.getService().getKeywordTrafficEstimates(request);
}
static function GetKeywordTrafficEstimates(
	$campaignEstimators)
{

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

	$request = new GetKeywordTrafficEstimatesRequest();

	$request->CampaignEstimators = $campaignEstimators;

	return $GLOBALS['AdInsightProxy']->GetService()->GetKeywordTrafficEstimates($request);
}
response=adinsight_service.GetKeywordTrafficEstimates(
	CampaignEstimators=CampaignEstimators)

Requirements

Service: AdInsightService.svc v13
Namespace: https://bingads.microsoft.com/AdInsight/v13

Request Url

https://adinsight.api.bingads.microsoft.com/AdInsight/v13/KeywordTrafficEstimates/Query

Request Elements

The GetKeywordTrafficEstimatesRequest object defines the body and header elements of the service operation request.

Note

Unless otherwise noted below, all request elements are required.

Request Body Elements

Element Description Data Type
CampaignEstimators Defines your campaign, ad group, and keyword level criteria and filters for the requested keyword traffic estimates. CampaignEstimator array

Request Header Elements

Element Description Data Type
Authorization The OAuth access token that represents the credentials of a user who has permissions to Microsoft Advertising accounts. Please ensure that the token is prefixed with "Bearer ", this is necessary for proper authentication.

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 GetKeywordTrafficEstimatesResponse 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 JSON.

Response Body Elements

Element Description Data Type
CampaignEstimates The list of campaign estimates. Within each campaign estimate is a nested list of keyword traffic estimates for each ad group.

You can inspect the BatchError Details element to find out which of the requested list items failed. For example if Details contains "CampaignEstimators[0], AdGroupEstimators[1], KeywordEstimators is null or contains no value", the error occurred for the 2nd AdGroupEstimator in the submitted list. The Index element of the BatchError is only a sequential count of returned batch errors, and cannot be used to determine where in the request the error occurred.
CampaignEstimate 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 JSON

This template was generated by a tool to show the body and header elements for the JSON request. For supported types that you can use with this service operation, see the Request Body Elements reference above.

{
  "CampaignEstimators": [
    {
      "AdGroupEstimators": [
        {
          "AdGroupId": "LongValueHere",
          "KeywordEstimators": [
            {
              "Keyword": {
                "Id": "LongValueHere",
                "MatchType": "ValueHere",
                "Text": "ValueHere"
              },
              "MaxCpc": DoubleValueHere
            }
          ],
          "MaxCpc": DoubleValueHere
        }
      ],
      "CampaignId": "LongValueHere",
      "Criteria": [
        "ValueHere"
      ],
      "DailyBudget": DoubleValueHere,
      "NegativeKeywords": [
        {
          "Id": "LongValueHere",
          "MatchType": "ValueHere",
          "Text": "ValueHere"
        }
      ]
    }
  ]
}

Response JSON

This template was generated by a tool to show the body and header elements for the JSON response.

{
  "CampaignEstimates": [
    {
      "AdGroupEstimates": [
        {
          "AdGroupId": "LongValueHere",
          "KeywordEstimates": [
            {
              "Keyword": {
                "Id": "LongValueHere",
                "MatchType": "ValueHere",
                "Text": "ValueHere"
              },
              "Maximum": {
                "AverageCpc": DoubleValueHere,
                "AveragePosition": DoubleValueHere,
                "Clicks": DoubleValueHere,
                "Ctr": DoubleValueHere,
                "Impressions": DoubleValueHere,
                "TotalCost": DoubleValueHere
              },
              "Minimum": {
                "AverageCpc": DoubleValueHere,
                "AveragePosition": DoubleValueHere,
                "Clicks": DoubleValueHere,
                "Ctr": DoubleValueHere,
                "Impressions": DoubleValueHere,
                "TotalCost": DoubleValueHere
              }
            }
          ]
        }
      ],
      "CampaignId": "LongValueHere"
    }
  ]
}

Code Syntax

To call REST API through SDKs, you need to upgrade SDK to a certain version and configure the system parameters.The example syntax can be used with Bing Ads SDKs. See Bing Ads API Code Examples for more examples.

public async Task<GetKeywordTrafficEstimatesResponse> GetKeywordTrafficEstimatesAsync(
	IList<CampaignEstimator> campaignEstimators)
{
	var request = new GetKeywordTrafficEstimatesRequest
	{
		CampaignEstimators = campaignEstimators
	};

	return (await AdInsightService.CallAsync((s, r) => s.GetKeywordTrafficEstimatesAsync(r), request));
}
static GetKeywordTrafficEstimatesResponse getKeywordTrafficEstimates(
	ArrayOfCampaignEstimator campaignEstimators) throws RemoteException, Exception
{
	GetKeywordTrafficEstimatesRequest request = new GetKeywordTrafficEstimatesRequest();

	request.setCampaignEstimators(campaignEstimators);

	return AdInsightService.getService().getKeywordTrafficEstimates(request);
}
static function GetKeywordTrafficEstimates(
	$campaignEstimators)
{

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

	$request = new GetKeywordTrafficEstimatesRequest();

	$request->CampaignEstimators = $campaignEstimators;

	return $GLOBALS['AdInsightProxy']->GetService()->GetKeywordTrafficEstimates($request);
}
response=adinsight_service.GetKeywordTrafficEstimates(
	CampaignEstimators=CampaignEstimators)