@adobe/react-native-acpanalytics

中文文档
2.0.1发布于 2022/04/29Apache-2.0CommonJS近 30 天下载 2987

Adobe Experience Platform support for React Native apps.

此软件包已被标记为弃用

Package no longer supported (underlying SDK deprecated)

原始使用文档
文档目录8 节
  1. Installation
  2. 1. Create React Native project
  3. 2. Install JavaScript packages
  4. Tests
  5. Usage
  6. Analytics
  7. Contributing
  8. License

React Native AEP Analytics Extension

npm version npm downloads CircleCI license

@adobe/react-native-acpanalytics is a wrapper around the iOS, tvOS and Android AEP Analytics SDK to allow for integration with React Native applications. Functionality to enable Adobe Analytics is provided entirely through JavaScript documented below.

Installation

Install the SDK with npm and configure the native Android/iOS project in your react native project. Before installing the Analytics extension, it is recommended to first install the Core extension.

Note: If you are new to React Native we suggest you follow the React Native Getting Started page before continuing.

1. Create React Native project

First create a React Native project:

react-native init MyReactApp

Note: Follow React Native tvos support to create app with tvos target.

2. Install JavaScript packages

Install and link the @adobe/react-native-acpanalytics package:

cd MyReactApp
npm install @adobe/react-native-acpanalytics
  • React Native 0.60+

CLI autolink feature links the module while building the app.

  • React Native <= 0.59
react-native link @adobe/react-native-acpanalytics

Note For iOS using cocoapods, run:

cd ios/ && pod install

Tests

This project contains jest unit tests which are contained in the __tests__ directory, to run the tests locally:

make run-tests-locally

Usage

Analytics

Importing the extension:

import {ACPAnalytics} from '@adobe/react-native-acpanalytics';

Getting the extension version:

ACPAnalytics.extensionVersion().then(version => console.log("AdobeExperienceSDK: ACPAnalytics version: " + version));

Registering the extension with ACPCore:

It is recommended to initialize the SDK via native code inside your AppDelegate and MainApplication in iOS and Android respectively.

iOS
#import <ACPAnalytics.h>

[ACPAnalytics registerExtension];
Android:
import com.adobe.marketing.mobile.Analytics;

Analytics.registerExtension();

Get the tracking identifier:

ACPAnalytics.getTrackingIdentifier().then(identifier => console.log("AdobeExperienceSDK: Tracking identifier: " + identifier));

Send queued hits:

ACPAnalytics.sendQueuedHits();

Get the queue size:

ACPAnalytics.getQueueSize().then(size => console.log("AdobeExperienceSDK: Queue size: " + size));

Clear queued hits:

ACPAnalytics.clearQueue();

Set the custom visitor identifier:

ACPAnalytics.setVisitorIdentifier("yourVisitorId");

Get the custom visitor identifier:

ACPAnalytics.getVisitorIdentifier().then(vid => console.log("AdobeExperienceSDK: Visitor identifier: " + vid));

Track app actions:

ACPCore.trackAction("action", {"mytest": "action"});

Track app states:

ACPCore.trackState("state", {"mytest": "state"});

Contributing

See CONTRIBUTING

License

See LICENSE

版本与发布记录

@adobe/react-native-acpanalytics 共发布 58 个版本,首次发布于 2019/04/04;过去 12 个月发布了 0 个版本。

版本发布日期距今
2.0.1latest2022/04/294 年前
2.0.02021/08/065 年前
1.3.02020/12/225 年前
1.2.62020/11/195 年前
1.1.62020/06/026 年前
1.1.52020/03/036 年前

关于 @adobe/react-native-acpanalytics 的常见问题

@adobe/react-native-acpanalytics 是什么?

Adobe Experience Platform support for React Native apps.注意:该包已被作者标记为弃用——Package no longer supported (underlying SDK deprecated)

如何安装 @adobe/react-native-acpanalytics?

在项目目录运行 npm install @adobe/react-native-acpanalytics,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react-native(>=0.60.0)、@adobe/react-native-acpcore(>=2.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adobe/react-native-acpanalytics 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/adobe__react-native-acpanalytics 是否存在。

@adobe/react-native-acpanalytics 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adobe/react-native-acpanalytics 可以商用吗?

@adobe/react-native-acpanalytics 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/react-native-acpanalytics 的下载量有多少?

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

@adobe/react-native-acpanalytics 还在维护吗?

最新版本 2.0.1 发布于 2022/04/29(4 年前);至今共发布 58 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/04/04。作者已将其标记为弃用,新项目建议寻找替代方案。