@nstudio/nativescript-appcues
Appcues SDK for NativeScript
npm i --save @nstudio/nativescript-appcues

Appcues NativeScript Plugin

Appcues NativeScript Plugin allows you to integrate Appcues experiences into your iOS and Android devices.

πŸš€ Getting Started

Prerequisites

Android - your application's App_Resources/Android/app.gradle must have a compileSdkVersion of 33+ and minSdkVersion of 21+

android {
compileSdkVersion 33

defaultConfig {
minSdkVersion 21
}
}

iOS - your application must target iOS 11+ to install the SDK, and iOS 13+ to render Appcues content. Update the App_Resources/iOS/build.xcconfig to set the deployment target, if needed. In the application's App_Resources/iOS/Podfile, include at least this minimum version.

# Podfile
platform :ios, '11.0'

Installation

In your app's root directory, run:

npm install @nstudio/nativescript-appcues

One Time Setup

Initializing the SDK

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

import { Application } from '@nativescript/core';
import { AppcuesSDK } from '@nstudio/nativescript-appcues';

Application.on(Application.launchEvent, () => {
AppcuesSDK.init('APPCUES_ACCOUNT_ID', '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.

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
AppcuesSDK.identify('my-user-id')
// Identify a user with property
AppcuesSDK.identify('my-user-id', { company: "Appcues"})

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 NativeScript Plugin, you can start tracking screens and events using the following methods:

// Track event
AppcuesSDK.track("Sent Message")
// Track event with property
AppcuesSDK.track("Deleted Contact", { id: 123 })

// Track screen
AppcuesSDK.screen("Contact List")
// Track screen with property
AppcuesSDK.screen("Contact List", { reference: "abc" })

πŸ“ Documentation

API is available here.

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

🎬 Examples

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

πŸ“„ License

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