Skip to content

Repository files navigation

Socketkit JavaScript SDK

Access Socketkit using cross-platform JavaScript SDK to anonymously track and understand user behavior with built-in security.

Install

npm i --save socketkit

Setup

importSocketkitfrom'socketkit'import{randomUUID}from'crypto'constoptions={authorization_key: 'authorization_key',signing_key: 'signing_key'}constclient=newSocketkit(options)// Store this preferably in your own database for future reference.constclientId=randomUUID()client.setClientId(clientId)client.sendEvent({name: 'custom',timestamp: newDate().toISOString(),custom_key: 'value'})

Send events

app_open

App open event type should be sent when the application is booted. Includes characteristic features of a client for analytical purposes. For properties and their requirements please look into the definition.

client.sendEvent({name: "app_open",timestamp: newDate().toISOString(),locale: 'en-US',manufacturer: 'Apple',platform: 'ios',type: 'iPad13,1',carrier: 'T-Mobile',os_name: 'iOS',os_version: '14.4.1',screen_size: [2778,1284],application_build_number: 14,application_version: '1.0.0',library_version: '0.4.1',watch_model: 'Apple Watch 38mm',// if the client is watchOS.})

in_app_purchase

Includes all the information related to tracking a in app purchase payment. For properties and their requirements please look into the definition.

client.sendEvent({name: "in_app_purchase",timestamp: newDate().toISOString(),product_name: "Weekly Package",product_quantity: 1,product_price: 4.99,product_currency: "USD"})

set_client

Set client event type gives the ability to store more information about the user. It should not store any identifiable data for privacy compliance. For properties and their requirements please look into the definition.

client.sendEvent({name: "set_client",timestamp: newDate().toISOString(),distinct_id: null,referer: "Google",push_token: null,is_opt_out: false,// required for GDPR complianceadditional_properties: {ab_test_enabled: false}})

custom

Custom event type gives the user the ability to send any kind of data to the Awacs server. For properties and their requirements please look into the definition.

client.sendEvent({name: "custom",timestamp: newDate().toISOString(),random_key: "value"})

About

Socketkit JavaScript Client and SDK for user-behavior analysis

Resources

Stars

12 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages