使用 @capgo/capacitor-appinsights
AppInsights 的包装器 https://github.com/apptopia/appinsights SDK.
安装
bun add @capgo/capacitor-appinsights
bunx cap sync
此插件暴露的内容
init- 初始化 AppInsights SDK。setUserId- 在初始化后设置或更新用户 ID。getState- 获取 SDK 的当前状态。
示例用法
init
初始化 AppInsights SDK。
import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';
await CapacitorAppInsights.init({} as {
partnerId: string; // Provided by our business unit
partnerKey: string; // Provided by our business unit
});
setUserId
初始化后更新用户 ID。
import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';
await CapacitorAppInsights.setUserId({} as { userId: string });
getState
获取 SDK 的当前状态。
import { CapacitorAppInsights } from '@capgo/capacitor-appinsights';
await CapacitorAppInsights.getState();
完整参考
- GitHub: https://github.com/Cap-go/capacitor-appinsights/
- 文档:/docs/plugins/appinsights/
继续使用 @capgo/capacitor-appinsights
如果您正在使用 使用 @capgo/capacitor-appinsights 为了计划原生插件的工作,连接它与 @capgo/capacitor-appinsights 在 @capgo/capacitor-appinsights 中的实现细节 开始使用 在开始使用中实现细节 Capgo 插件目录 在 Capgo 插件目录中的产品工作流程 Capacitor 由 Capgo 提供的插件 在 Capacitor 由 Capgo 提供的插件中实现细节,并且 添加或更新插件 在添加或更新插件中实现细节。