跳过主要内容
返回插件
@capgo/capacitor-appinsights
教程
由 github.com/Cap-go

AppInsights

使用Apptopia AppInsights跟踪应用程序使用情况、性能指标和用户行为

指南

AppInsights 教程

使用 @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();

全局参考