适用于 Dynamics 365 渠道集成框架 2.0 的 logAnalyticsEvent(JavaScript API 参考)

调用此方法以记录自定义事件的分析。

Syntax

Microsoft.CIFramework.logAnalyticsEvent(data, eventName, correlationId).then(successCallback, errorCallback);

参数

Name 类型 必选 Description
数据 JSON 对象 是的 JSON 输入
事件名称 String 是的 事件名称
correlationId GUID 用于将所有相关 API 调用分组在一起以进行诊断遥测。
success回调 功能 成功返回 Promise 时要调用的函数。
errorCallback 功能 当返回 promise 的请求失败时调用的函数。

下面是参数 JSON 的 data 结构。 请务必包含字段: conversationIdproviderSessionId

{
	"conversationId": "<Conversation identifier>",
	"providerSessionId": "<Channel Integration Framework Provider Id>",
	"clientSessionId":"<Client session identifier>",
	"participantId":"<Participant identifier>",
	"events": [
		{
			"kpiEventName": "<Name of the associated KPI event>",
			"kpiEventReason": "<Reason due to which the KPI event was created>",
			"eventTimestamp": "<Timestamp at which the event occurred>",
			"additionalData": "<Additional data related to the session>",
			"notificationResponseAction":"<Agent notification response action value>",
			"externalCorrelationId": "<External system correlation Id>",
			"customData": [
				{
					"attribute": "<name>",
					"value": "<value>"
				}
			]
		}
	]
}

返回值

以值为字符串的 Promise

Example

//Success callback handler
const successCallback = (result) => {
  // result will indicate if the custom analytics event has been logged
  console.log(result);
};

//Failure callback handler
const errorCallback = (error) => {
  // handling failure
  console.error(error)
};

Microsoft.CIFramework.logAnalyticsEvent(data, eventName, correlationId).then(successCallback, errorCallback);

updateConversation 方法
频道分析