Install
The Tealium NativeScript integration provides a set of cross-platform interfaces and configuration classes that interface with the native Tealium iOS and Android SDKs.
Requirements
- Access to your native build environments
- NativeScript Plugin and tools installed
- Android Studio or Xcode
Sample App
To help familiarize yourself with our library, the tracking methods, and best practice implementation, download the NativeScript sample app.
To run the sample app, run the command npm i
to install all dependencies, and then run npm start
in the root directory (tealium-nativescript-plugin
). Depending on your platform, select apps.demo.android
or apps.demo.ios
.
There is currently a known issue with NativeScript on iOS where the initial app build fails. To build successfully, open the file .xcworkspace
and go to Project > Build Settings > Validate Workspace and set the property to Yes
.
Install (NPM)
To install the Tealium library for NativeScript with NPM:
Navigate to the root of your NativeScript project.
Download and install the
@tealium/nativescript-plugin
package with the command:npm i @tealium/nativescript-plugin
TypeScript
After installation, import the Tealium module into your app’s TypeScript code:
import { Tealium } from '@tealium-nativescript/tealium';
import {
TealiumConfig, TealiumView, TealiumEvent, ConsentCategories, Dispatchers, Collectors,ConsentPolicy,
Expiry, ConsentStatus, TealiumEnvironment } from '@tealium-nativescript/tealium/common';
Initialize
After your app has been installed, initialize the Tealium
instance with the initialize()
method using TealiumConfig initialization options:
let config: TealiumConfig = {
account: 'ACCOUNT',
profile: 'PROFILE',
environment: TealiumEnvironment.dev,
dispatchers: [
Dispatchers.Collect,
Dispatchers.RemoteCommands,
Dispatchers.TagManagement
],
collectors: [
Collectors.AppData,
Collectors.DeviceData,
Collectors.Lifecycle,
Collectors.Connectivity
],
consentPolicy: ConsentPolicy.gdpr,
visitorServiceEnabled: true
};
Tealium.initialize(config);
See the API Reference for more information and additional configuration options.