GetHistoricalKeywordPerformance 服务操作 - Ad Insight
获取规范化搜索词的历史性能。 结果按设备类型聚合。
请求元素
GetHistoricalKeywordPerformanceRequest 对象定义服务操作请求的正文和标头元素。 元素的顺序必须与 请求 SOAP 中所示的顺序相同。
注意
除非下面另有说明,否则需要所有请求元素。
请求正文元素
元素 | 说明 | 数据类型 |
---|---|---|
设备 | 以下一种或多种设备类型的列表:计算机、非智能手机、智能手机、平板电脑。 默认值为“计算机”。 响应包括仅指定的设备类型的关键字 (keyword) 性能数据(如果可用)。 用于确定关键字 (keyword) 在指定设备类型上的性能。 |
字符串 数组 |
关键字 | 要获取其历史性能统计信息的关键字数组。 数组最多可以包含 1,000 个关键字,每个关键字 (keyword) 最多可以包含 100 个字符。 | 字符串 数组 |
语言 | 编写关键字时使用的语言。 在 PublisherCountries 元素中指定的国家/地区必须支持指定的语言。 可能的值包括丹麦语、荷兰语、英语、芬兰语、法语、德语、意大利语、挪威语、葡萄牙语、西班牙语、瑞典语和繁体中文。 |
string |
MatchTypes | 要获取其历史数据的匹配类型。 不能指定内容匹配类型。 |
MatchType 数组 |
PublisherCountries | 要用作历史数据源的国家/地区的国家/地区代码。 可以指定一个或多个国家/地区代码。 指定的每个国家/地区都必须支持 Language 元素中指定的 语言 。 支持以下语言和国家/地区组合: 丹麦语:DK 荷兰语:NL 英语:AU、CA、GB、ID、IN、MY、PH、SG、TH、US、VN 芬兰语:FI 法语:CA、FR 德语:AT、CH、DE 意大利语:IT 挪威语:NB 葡萄牙语:BR 西班牙语:AR、CL、CO、ES、MX、PE、VE 瑞典语:SE 繁体中文:HK、TW 如果此元素为 null,则默认情况下,服务将包括支持指定语言的所有国家/地区。 |
字符串 数组 |
TargetAdPosition | 要获取其性能数据的搜索结果的位置。 例如,若要使用关键字 (keyword) 和匹配类型获取广告出现在主线的第一位置时的性能数据,请将此元素设置为 MainLine1。 若要使用关键字 (keyword) 和匹配类型获取广告出现在搜索结果的任何位置时的性能数据,请将此元素设置为 All。 SixMonths 如果为此元素指定 All,则服务将为每个受支持的广告位置返回每个关键字 (keyword) 多个结果。 如果指定“聚合”,则服务将返回一个聚合结果。 侧边栏广告不再在美国必应拥有和运营的网站上提供。 如果仅请求第一页数据(例如,美国 (US) 的 FirstPage1),则结果中的 KeywordKPI 元素将为 nil/empty。 如果在同一请求中包含其他国家/地区(例如美国和 CA),则任何首页结果仅归因于美国以外的国家/地区。 |
AdPosition |
TimeInterval | 标识用于确定指定关键字的关键性能索引的数据的时间段。 例如,使用前 7 天或前 30 天的数据来确定关键字 (keyword) 性能。 默认值为 LastDay。 |
TimeInterval |
请求标头元素
元素 | 说明 | 数据类型 |
---|---|---|
AuthenticationToken | OAuth 访问令牌,表示有权Microsoft广告帐户的用户的凭据。 有关详细信息,请参阅 使用 OAuth 进行身份验证。 |
string |
CustomerAccountId | 拥有或与请求中的实体关联的广告帐户的标识符。 如果需要这两个元素,此标头元素必须与 AccountId 正文元素具有相同的值。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。 有关详细信息,请参阅 获取帐户和客户 ID。 |
string |
CustomerId | 用户正在访问或操作的客户) 经理帐户 (标识符。 用户可以访问多个经理帐户。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。 有关详细信息,请参阅 获取帐户和客户 ID。 |
string |
DeveloperToken | 用于访问必应广告 API 的开发人员令牌。 有关详细信息,请参阅 获取开发人员令牌。 |
string |
Password | 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 | string |
UserName | 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 | string |
响应元素
GetHistoricalKeywordPerformanceResponse 对象定义服务操作响应的正文和标头元素。 元素的返回顺序与 响应 SOAP 中所示的顺序相同。
响应正文元素
元素 | 说明 | 数据类型 |
---|---|---|
KeywordHistoricalPerformances | KeywordHistoricalPerformance 数据对象的数组。 数组包含请求中指定的每个关键字 (keyword) 、设备、匹配类型和广告位置的项。 如果关键字 (keyword) 无效或没有可用数据,则数组中的相应项将为 null。 | KeywordHistoricalPerformance 数组 |
响应标头元素
元素 | 说明 | 数据类型 |
---|---|---|
跟踪 ID | 包含 API 调用详细信息的日志条目的标识符。 | string |
请求 SOAP
此模板由一个工具生成,用于显示 SOAP 请求的正文和标头元素的顺序。 有关可用于此服务操作的支持类型,请参阅上面的 请求正文元素 参考。
<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">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>
</s:Header>
<s:Body>
<GetHistoricalKeywordPerformanceRequest 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>
<TimeInterval i:nil="false">ValueHere</TimeInterval>
<TargetAdPosition i:nil="false">ValueHere</TargetAdPosition>
<MatchTypes i:nil="false">
<MatchType>ValueHere</MatchType>
</MatchTypes>
<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>
<Devices i:nil="false" xmlns:a1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a1:string>ValueHere</a1:string>
</Devices>
</GetHistoricalKeywordPerformanceRequest>
</s:Body>
</s:Envelope>
响应 SOAP
此模板由一个工具生成,用于显示 SOAP 响应的 正文 和 标头 元素的顺序。
<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>
<GetHistoricalKeywordPerformanceResponse xmlns="https://bingads.microsoft.com/AdInsight/v13">
<KeywordHistoricalPerformances d4p1:nil="false" xmlns:d4p1="http://www.w3.org/2001/XMLSchema-instance">
<KeywordHistoricalPerformance>
<Keyword d4p1:nil="false">ValueHere</Keyword>
<KeywordKPIs d4p1:nil="false">
<KeywordKPI>
<Device d4p1:nil="false">ValueHere</Device>
<MatchType>ValueHere</MatchType>
<AdPosition>ValueHere</AdPosition>
<Clicks>ValueHere</Clicks>
<Impressions>ValueHere</Impressions>
<AverageCPC>ValueHere</AverageCPC>
<CTR>ValueHere</CTR>
<TotalCost>ValueHere</TotalCost>
<AverageBid>ValueHere</AverageBid>
</KeywordKPI>
</KeywordKPIs>
</KeywordHistoricalPerformance>
</KeywordHistoricalPerformances>
</GetHistoricalKeywordPerformanceResponse>
</s:Body>
</s:Envelope>
代码语法
示例语法可用于 必应广告 SDK。 有关更多示例,请参阅 必应广告 API 代码示例 。
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();
request.setKeywords(keywords);
request.setTimeInterval(timeInterval);
request.setTargetAdPosition(targetAdPosition);
request.setMatchTypes(matchTypes);
request.setLanguage(language);
request.setPublisherCountries(publisherCountries);
request.setDevices(devices);
return AdInsightService.getService().getHistoricalKeywordPerformance(request);
}
static function GetHistoricalKeywordPerformance(
$keywords,
$timeInterval,
$targetAdPosition,
$matchTypes,
$language,
$publisherCountries,
$devices)
{
$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);
}
response=adinsight_service.GetHistoricalKeywordPerformance(
Keywords=Keywords,
TimeInterval=TimeInterval,
TargetAdPosition=TargetAdPosition,
MatchTypes=MatchTypes,
Language=Language,
PublisherCountries=PublisherCountries,
Devices=Devices)
要求
服务: AdInsightService.svc v13
命名空间: https://bingads.microsoft.com/AdInsight/v13
请求 URL
https://adinsight.api.bingads.microsoft.com/AdInsight/v13/HistoricalKeywordPerformance/Query
请求元素
GetHistoricalKeywordPerformanceRequest 对象定义服务操作请求的正文和标头元素。
注意
除非下面另有说明,否则需要所有请求元素。
请求正文元素
元素 | 说明 | 数据类型 |
---|---|---|
设备 | 以下一种或多种设备类型的列表:计算机、非智能手机、智能手机、平板电脑。 默认值为“计算机”。 响应包括仅指定的设备类型的关键字 (keyword) 性能数据(如果可用)。 用于确定关键字 (keyword) 在指定设备类型上的性能。 |
字符串 数组 |
关键字 | 要获取其历史性能统计信息的关键字数组。 数组最多可以包含 1,000 个关键字,每个关键字 (keyword) 最多可以包含 100 个字符。 | 字符串 数组 |
语言 | 编写关键字时使用的语言。 在 PublisherCountries 元素中指定的国家/地区必须支持指定的语言。 可能的值包括丹麦语、荷兰语、英语、芬兰语、法语、德语、意大利语、挪威语、葡萄牙语、西班牙语、瑞典语和繁体中文。 |
string |
MatchTypes | 要获取其历史数据的匹配类型。 不能指定内容匹配类型。 |
MatchType 数组 |
PublisherCountries | 要用作历史数据源的国家/地区的国家/地区代码。 可以指定一个或多个国家/地区代码。 指定的每个国家/地区都必须支持 Language 元素中指定的 语言 。 支持以下语言和国家/地区组合: 丹麦语:DK 荷兰语:NL 英语:AU、CA、GB、ID、IN、MY、PH、SG、TH、US、VN 芬兰语:FI 法语:CA、FR 德语:AT、CH、DE 意大利语:IT 挪威语:NB 葡萄牙语:BR 西班牙语:AR、CL、CO、ES、MX、PE、VE 瑞典语:SE 繁体中文:HK、TW 如果此元素为 null,则默认情况下,服务将包括支持指定语言的所有国家/地区。 |
字符串 数组 |
TargetAdPosition | 要获取其性能数据的搜索结果的位置。 例如,若要使用关键字 (keyword) 和匹配类型获取广告出现在主线的第一位置时的性能数据,请将此元素设置为 MainLine1。 若要使用关键字 (keyword) 和匹配类型获取广告出现在搜索结果的任何位置时的性能数据,请将此元素设置为 All。 SixMonths 如果为此元素指定 All,则服务将为每个受支持的广告位置返回每个关键字 (keyword) 多个结果。 如果指定“聚合”,则服务将返回一个聚合结果。 侧边栏广告不再在美国必应拥有和运营的网站上提供。 如果仅请求第一页数据(例如,美国 (US) 的 FirstPage1),则结果中的 KeywordKPI 元素将为 nil/empty。 如果在同一请求中包含其他国家/地区(例如美国和 CA),则任何首页结果仅归因于美国以外的国家/地区。 |
AdPosition |
TimeInterval | 标识用于确定指定关键字的关键性能索引的数据的时间段。 例如,使用前 7 天或前 30 天的数据来确定关键字 (keyword) 性能。 默认值为 LastDay。 |
TimeInterval |
请求标头元素
元素 | 说明 | 数据类型 |
---|---|---|
Authorization | OAuth 访问令牌,表示有权Microsoft广告帐户的用户的凭据。 请确保令牌的前缀为“持有者”,这是正确身份验证所必需的。 有关详细信息,请参阅 使用 OAuth 进行身份验证。 |
string |
CustomerAccountId | 拥有或与请求中的实体关联的广告帐户的标识符。 如果需要这两个元素,此标头元素必须与 AccountId 正文元素具有相同的值。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。 有关详细信息,请参阅 获取帐户和客户 ID。 |
string |
CustomerId | 用户正在访问或操作的客户) 经理帐户 (标识符。 用户可以访问多个经理帐户。 此元素是大多数服务操作所必需的,作为最佳做法,应始终设置它。 有关详细信息,请参阅 获取帐户和客户 ID。 |
string |
DeveloperToken | 用于访问必应广告 API 的开发人员令牌。 有关详细信息,请参阅 获取开发人员令牌。 |
string |
Password | 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 | string |
UserName | 此元素保留供内部使用,将从 API 的未来版本中删除。 必须使用 AuthenticationToken 元素来设置用户凭据。 | string |
响应元素
GetHistoricalKeywordPerformanceResponse 对象定义服务操作响应的正文和标头元素。 元素的返回顺序与 响应 JSON 中所示的顺序相同。
响应正文元素
元素 | 说明 | 数据类型 |
---|---|---|
KeywordHistoricalPerformances | KeywordHistoricalPerformance 数据对象的数组。 数组包含请求中指定的每个关键字 (keyword) 、设备、匹配类型和广告位置的项。 如果关键字 (keyword) 无效或没有可用数据,则数组中的相应项将为 null。 | KeywordHistoricalPerformance 数组 |
响应标头元素
元素 | 说明 | 数据类型 |
---|---|---|
跟踪 ID | 包含 API 调用详细信息的日志条目的标识符。 | string |
请求 JSON
此模板由显示 JSON 请求的 正文 和 标头 元素的工具生成。 有关可用于此服务操作的支持类型,请参阅上面的 请求正文元素 参考。
{
"Keywords": [
"ValueHere"
],
"TimeInterval": "ValueHere",
"TargetAdPosition": "ValueHere",
"MatchTypes": [
"ValueHere"
],
"Language": "ValueHere",
"PublisherCountries": [
"ValueHere"
],
"Devices": [
"ValueHere"
]
}
响应 JSON
此模板由一个工具生成,用于显示 JSON 响应的 正文 和 标头 元素。
{
"KeywordHistoricalPerformances": [
{
"Keyword": "ValueHere",
"KeywordKPIs": [
{
"AdPosition": "ValueHere",
"AverageBid": DoubleValueHere,
"AverageCPC": DoubleValueHere,
"Clicks": IntValueHere,
"CTR": DoubleValueHere,
"Device": "ValueHere",
"Impressions": "LongValueHere",
"MatchType": "ValueHere",
"TotalCost": DoubleValueHere
}
]
}
]
}
代码语法
若要通过 SDK 调用 REST API,需要将 SDK 升级到特定版本并配置系统参数。示例语法可用于 必应广告 SDK。 有关更多示例,请参阅 必应广告 API 代码示例 。
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();
request.setKeywords(keywords);
request.setTimeInterval(timeInterval);
request.setTargetAdPosition(targetAdPosition);
request.setMatchTypes(matchTypes);
request.setLanguage(language);
request.setPublisherCountries(publisherCountries);
request.setDevices(devices);
return AdInsightService.getService().getHistoricalKeywordPerformance(request);
}
static function GetHistoricalKeywordPerformance(
$keywords,
$timeInterval,
$targetAdPosition,
$matchTypes,
$language,
$publisherCountries,
$devices)
{
$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);
}
response=adinsight_service.GetHistoricalKeywordPerformance(
Keywords=Keywords,
TimeInterval=TimeInterval,
TargetAdPosition=TargetAdPosition,
MatchTypes=MatchTypes,
Language=Language,
PublisherCountries=PublisherCountries,
Devices=Devices)