@gitlab/application-sdk-node
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

GitLab Application SDK - Node

This SDK is for using GitLab Application Services with Node.

How to use the SDK

Using the NPM package

Add the NPM package to your package JSON using your preferred package manager:

yarn add @gitlab/application-sdk-node

OR

npm i @gitlab/application-sdk-node

Initialize SDK

import { GitLabSDK } from '@gitlab/application-sdk-node';

const glSDK = new GitLabSDK({ app_id: 'YOUR_APP_ID', host: 'YOUR_HOST' });

SDK initialization options

Option Description
app_id The ID specified in the GitLab Project Analytics setup guide. It ensures your data is sent to your analytics instance.
host The GitLab Project Analytics instance specified in the setup guide.

Methods

identify

Used to associate a user and their attributes with the session and tracking events.

glSDK.identify('123abc', { user_name: 'Matthew' });
Property Type Description
user_id String The ID of the user.
user_attributes Hash Optional. The user attributes to add to the session and tracking events.

track

Used to trigger a custom event.

glSDK.track(event_name, event_attributes);
Property Type Description
event_name String The name of the custom event.
event_attributes Hash The event attributes to add to the tracked event.

Developing with the devkit

To develop with a local Snowplow pipeline, use Analytics devkit's Snowplow setup.

Contribute

Want to contribute to the GitLab Application SDK - Node? follow contributing guide.

Readme

Keywords

Package Sidebar

Install

npm i @gitlab/application-sdk-node

Weekly Downloads

1

Version

0.0.3

License

none

Unpacked Size

1.96 MB

Total Files

18

Last publish

Collaborators

  • apanchal-gitlab
  • rob.hunt-gitlab
  • gitlab-administration
  • tzallmann
  • gitlab-bot
  • leipert