JavaScript Client

Integrate with your JavaScript project in minutes

Installation

Using JavaScript you can easily add UserLog to your project by installing the package from npm:

npm install @userlog/js

Initialize Client

Now you can use the UserLog client like this:

import { UserLog } from '@userlog/js';

const userLog = new UserLog({
  api_key: '<YOUR_API_KEY>',
  project: '<YOUR_PROJECT_NAME>'
});

Usage

Now you can use the UserLog client like this:

userLog.track({
  channel: "registrations",
  event: "New Registration",
  user_id: "user@example.com",
  icon: "💰",
  notify: false,
  tags: {
    referrer: "example.com",
    utm_source: "google",
    utm_medium: "cpc",
  }
});

Tipps

Getting startet with UserLog API is simple. Just add user_id after a user loggs in, and start tracking your events! All logged events will link to the user who set off the event. This will help you understand user behavior. You can track events such as order made, item added to cart, new subscription created, or feedback submitted.