@appcues/capacitor

中文文档
5.0.7发布于 2026/10/22MITTypeScriptESM + CJS零依赖近 30 天下载 3.2万

Capcitor plugin to bridge the native Android and iOS Appcues mobile SDKs in an Ionic application.

原始使用文档
文档目录11 节
  1. 🚀 Getting Started
  2. Prerequisites
  3. Installation
  4. One Time Setup
  5. Identifying Users
  6. Tracking Screens and Events
  7. Anchored Tooltips
  8. 📝 Documentation
  9. 🎬 Examples
  10. 👷 Contributing
  11. 📄 License

Appcues Capacitor Plugin

CircleCI npm License: MIT

Appcues Capacitor Plugin allows you to integrate Appcues experiences into your Ionic apps for iOS and Android devices.

This capacitor is a bridge between the native Appcues SDKs in an Ionic application which sends user properties and events to the Appcues API and retrieves and renders Appcues content based on those properties and events.

🚀 Getting Started

Prerequisites

The latest package version requires Capacitor 8. Use @appcues/[email protected] for Capacitor 7.

Android

Your application's build.gradle must have a compileSdkVersion of 36+ and minSdkVersion of 24+. Your project should use the Android Gradle Plugin (AGP) version 8.13+.

android {
    compileSdkVersion 36

    defaultConfig {
        minSdkVersion 24
    }
}

Due to the SDK usage of Jetpack Compose, AGP 8 apps must apply the kotlin-android plugin in the app build.gradle. AGP 9+ enables built-in Kotlin by default and should not apply it.

plugins {
  id 'com.android.application'
  id 'kotlin-android' // AGP 8 only
}

iOS

Your application must target iOS 15+. Update the iOS project xcodeproj to set the deployment target, if needed.

Installation

In your app's root directory, run:

npm install @appcues/capacitor

npx cap sync

Note: You do not need to manually update your Podfile to add Appcues.

One Time Setup

Initializing the SDK

An instance of the Appcues SDK should be initialized when your app launches.

import { Appcues } from '@appcues/capacitor';

Appcues.initialize({
  accountId: 'APPCUES_ACCOUNT_ID',
  applicationId: 'APPCUES_APPLICATION_ID',
});

Initializing the SDK requires you to provide two values, an Appcues account ID, and an Appcues mobile application ID. These values can be obtained from your Appcues settings. Refer to the help documentation on Registering your mobile app in Studio for more information.

Configuring Hosting Environment

By default, the Appcues SDK will send data to the United States (US) hosting environment, and no additional configuration is required. To specify a different hosting environment, pass a config with the apiBasePath and settingsHost options during initialization.

EU Hosting Environment Configuration
Appcues.initialize({
  accountId: 'APPCUES_ACCOUNT_ID',
  applicationId: 'APPCUES_APPLICATION_ID',
  config: {
    apiBasePath: 'https://api.eu.appcues.net',
    settingsHost: 'https://fast.eu.appcues.com',
  },
});

Supporting Builder Preview and Screen Capture

During installation, follow the steps outlined in Configuring the Appcues URL Scheme. This is necessary for the complete Appcues builder experience, supporting experience preview, screen capture and debugging.

Enabling Push Notifications

In an Ionic app, push notifications are configured in the native projects for iOS and Android. Please refer to native documentation on iOS and Android for more details. The example directory in this repository contains a reference implementation that includes push notification support.

Identifying Users

In order to target content to the right users at the right time, you need to identify users and send Appcues data about them. A user is identified with a unique ID.

// Identify a user
Appcues.identify({ userId: 'my-user-id' });
// Identify a user with property
Appcues.identify({ userId: 'my-user-id', properties: { company: 'Appcues' } });

After identifying a user, you can optionally associate that user with group.

// Associate a user with a group, optionally including group properties
Appcues.group({ groupId: 'group-id', properties: { plan: 'standard' } });

To ensure the most accurate content targeting based upon group information, it's recommended to supply the group information immediately after a new user is identified.

Tracking Screens and Events

Events are the “actions” your users take in your application, which can be anything from clicking a certain button to viewing a specific screen. Once you’ve installed and initialized the Appcues Capacitor Plugin, you can start tracking screens and events using the following methods:

// Track event
Appcues.track({ name: 'Sent Message' });
// Track event with property
Appcues.track({ name: 'Deleted Contact', properties: { id: 123 } });

// Track screen
Appcues.screen({ title: 'Contact List' });
// Track screen with property
Appcues.screen({ title: 'Contact List', properties: { reference: 'abc' } });

Anchored Tooltips

Anchored tooltips use element targeting to point directly at specific views in your application. For more information about how to configure your application's views for element targeting, refer to the Anchored Tooltips Guide.

📝 Documentation

More technical documentation about this capacitor is available in the docs. Auto-generated documentation is available here.

Full documentation is available at https://docs.appcues.com/

🎬 Examples

The example directory in this repository contains full example iOS/Android app to providing references for correct installation and usage of the Appcues API.

👷 Contributing

See the contributing guide to learn how to get set up for development and how to contribute to the project.

📄 License

This project is licensed under the MIT License. See LICENSE for more information.

版本与发布记录

@appcues/capacitor 共发布 47 个版本,首次发布于 2022/09/28;过去 12 个月发布了 7 个版本。

版本发布日期距今
5.0.7latest2026/10/2216 天前
5.0.62026/10/2216 天前
5.0.52026/10/1622 天前
5.0.42026/09/111 个月前
5.0.32026/06/184 个月前
5.0.22026/03/267 个月前

关于 @appcues/capacitor 的常见问题

@appcues/capacitor 是什么?

Capcitor plugin to bridge the native Android and iOS Appcues mobile SDKs in an Ionic application.

如何安装 @appcues/capacitor?

在项目目录运行 npm install @appcues/capacitor,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@capacitor/core(^8.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@appcues/capacitor 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@appcues/capacitor 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@appcues/capacitor 可以商用吗?

@appcues/capacitor 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@appcues/capacitor 的下载量有多少?

根据 npm 官方下载统计,@appcues/capacitor 在 2026/10/07 – 2026/11/05 这 30 天内被下载 32,465 次,日均约 1,082 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@appcues/capacitor 还在维护吗?

最新版本 5.0.7 发布于 2026/10/22(16 天前);至今共发布 47 个版本,其中过去 12 个月发布了 7 个;首次发布于 2022/09/28。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。