ingrow-js-sdk

1.1.5 • Public • Published

Ingrow JS SDK

This Javascript SDK is created by Ingrow. It helps you send events in your web applications to the Ingrow event streaming platform to make insights based on them.

MIT License NPM version

Install and Initialize ingrow-js-sdk in an HTML file

<script type="text/javascript"  src="https://ingrow-cdn.s3.ir-thr-at1.arvanstorage.com/ingrow-sdk.js"></script>
<script>
    var myIngrow = new Ingrow("API_KEY", "PROJECT_ID")
</script>

Install and Initialize ingrow-js-sdk in front-end JavaScript projects

Install with npm or yarn

npm install ingrow-js-sdk

Import SDK

import Ingrow from "ingrow-js-sdk"

After importing SDK, you must initialize it by giving api key and project id that you have received from Ingrow panel.

const myIngrow = new Ingrow("API_KEY", "PROJECT_ID")

Set your users

It is possible to trace events related to specific user by adding user id to arguments and initialize like this:

const myIngrow = new Ingrow("API_KEY", "PROJECT_ID", "USER_ID")

Or using setUserID method

myIngrow.setUserID("USER_ID")

By default ingrow set an id in localstorage for all users which is gravely useful for data analysis

By default the IP of user will attached automatically to events but You can overwrite by sending the according IP in your custom data with IP key.

Send Event

After initializing SDK, you can send event using sendEvent() method. You must pass stream name and custom data, and optionally pass options which is described bellow. for example:

myIngrow.sendEvent("STREAM_NAME", {
    description: "paginate",
    event_type: "Click",
    element_type: "Button",
}, {
    sendDeviceInfo: false, // append some information about users device
    done: () => {}, // it will be called when it gets done
})

Package Sidebar

Install

npm i ingrow-js-sdk

Weekly Downloads

3

Version

1.1.5

License

MIT

Unpacked Size

11.1 kB

Total Files

10

Last publish

Collaborators

  • fingerpich
  • paknahad
  • ashkan4ever