1.0.3 • Published 4 years ago

@connectedinteractive/sdk v1.0.3

Weekly downloads
29
License
ISC
Repository
github
Last release
4 years ago

ConnectedSDK

This package helps you integrate ConnectedSDK into your application easily

Getting Started

  • Install with npm:

    npm install @connectedinteractive/sdk

  • Install with yarn:

    yarn add @connectedinteractive/sdk

Quick Start

Just add the following code:

import ConnectedSDK  from '@connectedinteractive/sdk';

/* ... */
ConnectedSDK.init({ app_key: "<your_app_key_comes_here>" }).then(() => {
    ConnectedSDK.trackEvent({ event_name: 'app_started' })
});

Initialize your app

Once installed, grab you app-key and include to your code:

import ConnectedSDK  from '@connectedinteractive/sdk';

    /* ... */

ConnectedSDK.init(options); // Call this function when your app opens.

options is an object that includes: | Option | default | type | required | description | | :-------- | :---------: | :------: | :------: | :----------------------------------------------------: | | app_key | undefined | string | Yes | Your application key provided by Connected Interactive |

Example

ConnectedSDK.init({ app_key: "<your_app_key_comes_here>" }); // Add your app_key here

Add a Custom Event

To track custom events place the following code to your page, after our library from the previous step:

import ConnectedSDK  from '@connectedinteractive/sdk';
// ...
ConnectedSDK.trackEvent(options)

options is an object that includes: | Option | default | type | required | description | | :------------ | :---------: | :------------------------: | :------: | :---------------------: | | event_name | undefined | string | Yes | Your custom event name | | event_value | undefined | string | number | bolean | No | Your custom event value |

Example

  • To track custom events place the following code to your page, after our library from the previous step:
ConnectedSDK.trackEvent({ 
    event_name: 'my_custom_event' 
});
  • If you want to track events that have a value such as a monetary value, you could call the following code:
ConnectedSDK.trackEvent({ 
    event_name: 'my_custom_event', 
    event_value: 'my_value' 
});