Socket
Socket
Sign inDemoInstall

segment-cordova-plugin-ng

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

segment-cordova-plugin-ng

Segment Cordova Plugin


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

segment-cordova-plugin

Cordova plugin for Segment mobile SDK

This version of the plugin uses versions 3.7.1 (iOS) and 4.3.1 (Android) of the Segment mobile SDK. You can view Android and iOS SDK sources on Github.

Prerequisites:

  • Segment API keys

Installing

You can install the latest version of the plugin directly from git through the Cordova CLI:

cordova plugin add https://github.com/kohofinancial/segment-cordova-plugin.git

Usage

In your 'deviceready' handler, start Segment Analytics :

window.Segment.startWithConfiguration(IOS_OR_ANDROID_KEY);

To track a Screen :

window.Segment.screen({
    name: 'Home',
    properties: {
        'path': '/home'
    }
});

To track an Event:

window.Segment.track({
    event: 'Order Completed',
    properties: {
        'revenue': 10
    }
});

To track an Identity:

window.Segment.identity({
    userId: 'segment_sdk_user',
    traits: {
        birthday: '2000-01-01'
    }
});

Configuration options for .startWithConfiguration()

You can configure number of options to setup SDK.

trackApplicationLifecycleEvents (Android and iOS)

Record certain application lifecycle events like Application Opened, Application Installed, Application Updated. (Default: false)

recordScreenViews (Android and iOS)

Record screen views automatically. It's not useful for the Cordova PhoneGap app. (Default: false)

defaultOptions (Android and iOS)

Specify which integrations should be enabled or not for all calls. (Default: All)

trackAttributionInformation (Android and iOS)

Record attribution data from enabled providers using the mobile service. (Default: false)

flushQueueSize (Android and iOS)

The queue size at which to flush events. (Default: 20, Max: 250 for Android and 100 for iOS)

enableBrazeIntegration (Android and iOS)

Enable device-mode connection to the Braze destination

collectDeviceId (Android)

Record the device id. (Default: true)

flushInterval (Android)

The interval at which the client should flush events (Default: 30 seconds)

tag (Android)

Key for caching. It's used to share different caches across the instances (Default: "analytics_write_key")

logLevel (Android)

Controls the level of logging (Default: INFO)

shouldUseLocationServices (iOS)

Use location services. (Default: false)

enableAdvertisingTracking (iOS)

Record advertising info. (Default: true)

shouldUseBluetooth (iOS)

Record bluetooth information. (Default: false)

trackInAppPurchases (iOS)

Record in-app purchases from the App Store. (Default: false)

trackPushNotifications (iOS)

Record push notifications. (Default: false)

Example Usage:

window.Segment.startWithConfiguration(IOS_OR_ANDROID_KEY, {
    trackApplicationLifecycleEvents: true,
    trackAttributionInformation: true,
    flushInterval: 60,
    trackInAppPurchases: true,
    enableBrazeIntegration: true
});

Keywords

FAQs

Package last updated on 17 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc