Helika Web SDK

Top of the funnel fingerprinting of your community upon first click.

Helika Web SDK Docs

The Helika SDK is a powerful toolkit for integrating Helika services into your applications. With the Helika SDK, you can easily leverage the full capabilities of Helika and build robust and scalable solutions.

Features

  • Streamline integration with Helika services
  • Access to a wide range of Helika APIs

📘

Current Version: 0.2.8

Installation

To install the Helika SDK, you can use npm:

npm install helika-sdk

Quick Start

You’ll need a Helika API Key in order to instantiate the Helika SDK. Please reach out to [email protected] in order to receive an API key for your organization.

Here's a quick example on how to get started with the Helika SDK:

import Helika, { DisableDataSettings, EventsBaseURL } from "helika-sdk"

var helika;

try {
	// Initialize the Helika SDK - it will throw if you use an invalid API key
  helika = new Helika.Events(
    'YOUR_API_KEY',
    'YOUR_GAME_ID', // alphanumeric, only underscore, no spaces, 
    EventsBaseURL.EVENTS_DEV
  );
} catch (e) {
	console.error("api key is invalid"); 
}

// Optional - if you want to disable some data from getting stored due to compliance
helikaSDK.setDataSettings(DisableDataSettings.None);

// Start a session/create a new session which initiates the SDK instance with a
// sessionId which is required to fire events. This should only be called when 
// the user lands on the page. We store and re-use the session_id from the local
// storage, if present.
await helikaSDK.startSession();

// Instantiate events based on your game's event taxonomy
const events = [
  {
    event_type: 'user_register',  // required
    event: {                      // required
      event_sub_type: 'register',
      user_id: 'user_1',
      win_number: 1,
      wallet: '0x4kd....'
      discord_id: 'discord id'
    }
  },
  {
    event_type: 'user_download',  // required
    event: {                      // required
      event_sub_type: 'download',
      user_id: 'user_1',
      twitter_id: 'twitterid'
    }
  }
];

// Asynchronously
// await helika.createEvent(events);

// Send an Event to Helika
helika.createEvent(events)
  .then(response => {
    console.log(response);
  })
  .catch(error => {
    console.error(error);
  });

API Reference

Conventions

The EventsBaseURL is an enum that dictates where to send all API requests. The SDK will handle the set-up for you. You just need to provide an API key and select whether it’s for production or development.
For testing purposes, we've added EVENTS_LOCAL which logs your events to console.log() instead of sending the events.

enum EventsBaseURL {
  EVENTS_LOCAL,
  EVENTS_DEV,
  EVENTS_PROD
}

Disable Data Settings

You can disable certain information from getting stored by using Events.setDataSettings(DisableDataSettings.All)

enum DisableDataSettings {
  None,
  BrowserInfo,
  DeviceInfo,
  IpInfo,
  OsInfo,
  VpnInfo,
  All
}

Game Event Taxonomy

In order for out event processors to parse your events, they must adhere to a specific guideline.

Example Event

{
  "event_type": "user_download",
  "event": {
    "userId": "user_1",
    "win_number": 1,
    "wallet": "0x4kd...."
  }
}

Automatic Data Capture

The Helika SDK automatically appends some data fields in the event along side your customized data event.

FieldTypeRequired/OptionalDescription
game_idstringrequiredThe Game Identifier attribute for all events generated for this game
created_atDateTimerequiredThe timestamp when the event was created.
session_idu4requiredThe sdk generates a new Session ID when the Helika Object is created.
utmsobjectoptionalThe SDK parses the url parameters and records any important or interesting UTMs.
helika_referral_linkstringoptionalThe Referral Link ID of the link that the user clicked in order to get to the game’s landing page.
fp_dataobjectoptionalWe keep track of all possible identifying information for the user. This will be sent on startSession()
player_idstringoptionalIf you'd like to keep track of a user's identifying information (user id, wallet address, in-game player id, etc), you can set the Player ID which get appended to all the events.

Methods

NameURLParameterDescription
constructorEvents()api_key: string,
game_id: string,
baseURL: EventsBaseURL
Constructs the Event Service
Start SessionEvents.startSession()
Create EventEvents.createEvent()events: {
game_id: string,
event_type: string,
event: Object
}[]
This starts a user session, stores identifying user information, and UTMs that will get appended to events.
Create UA EventEvents.createUAEvent()events: {
game_id: string,
event_type: string,
event: Object
}[]
Sends the events to the Helika services
Set Data SettingsEvents.setDataSettings()settings: DisableDataSettingsDisables storing certain data such as IP, location, browser info, device info, etc.
Set Player IDEvents.setPlayerID()playerId: stringSets the player_id field that gets added to all events
Get Player IDEvents.getPlayerID()Gets the player_id that will get appended to all events
Set EnabledEvents.setEnabled()enabled: booleanSets whether it's sending the events to our data pipeline or simply logging the event to console.log(). This is used for testing purposes.
Is EnabledEvents.isEnabled()Gets whether the Sending Events is enabled or disabled

Validation

It is recommended that you verify events are being ingested correctly by sending some test events via the SDK. Successfully sent events should have a 200 status response.

Check within your portal for the events to appear in the Data Ingestion Summary.

The Data Ingestion Summary report can be found in the side menu:

  • Data Summary > Data Ingestion Summary

The Data Ingestion Summary will display information such as:

  • Which environment the events are being sent to
  • Total Event Volumes
  • Types, and Sub Types Seen
  • A table for the raw event stream, with raw payload.

🚧

Ingestion Delays

Please expect up to the following delays during event processing, before results are populated:

  • Production: 15 minutes
  • Development: 2 hours

After seeing some test events appear, this report can be used to monitor your ongoing events and event volumes, as they are added.

License

The Helika SDK is released under the MIT License.