跳过主要内容
返回插件
@capgo/capacitor-appinsights
教程
@capgo/capacitor-appinsights

AppInsights

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

指南

AppInsights教程

在设备上测试

Download the Capgo app, then scan the QR code.

AppInsights插件预览二维码code

使用@capgo/capacitor-appinsights

AppInsights插件的包装 https://github.com/apptopia/appinsights SDK.

安装

bun add @capgo/capacitor-appinsights
bunx cap sync

此插件暴露的内容

  • init - 初始化AppInsightsSDK.
  • 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();

全局参考

继续使用 @capgo/capacitor-appinsights

如果您正在使用 使用 @capgo/capacitor-appinsights 来规划原生插件工作,连接它到 @capgo/capacitor-appinsights 为 @capgo/capacitor-appinsights 的实现细节 开始使用 为 Getting Started 的实现细节 Capgo 插件目录 为 Capgo 插件目录 的产品工作流程 Capacitor 由 Capgo 提供的插件 为 Capacitor 由 Capgo 提供的插件 的实现细节, 添加或更新插件 为添加或更新插件 的实现细节