Maqetin records the first event your app sends.

Install the SDK, identify a person and track one event. Then find it on their profile.

Install the SDK

One package, @maqetin/sdk-js, holds the browser entry and the server entry. Both are ES modules, and Node 22.12 or later runs them.

npm install @maqetin/sdk-js

Identify a person and track an event

Make a client with a publishable key, which starts with mq_live_. Call identify() when someone signs in and track() when they do something that matters.

import { MaqetinClient } from '@maqetin/sdk-js';

const mq = new MaqetinClient({ publicKey: 'mq_live_…' });
mq.identify('u_42', { email: 'ada@example.com', firstName: 'Ada' });
mq.track('checkout.completed', { total: 12.5 });

The client refuses a secret key. Name events object.action in lower case, such as checkout.completed.

The events page lists the fields each call takes.

Forget the person on sign-out

Call reset() when someone logs out. The SDK keeps the identified person in the browser's storage, so without the call the next person who uses that browser is tracked as the previous one.

async function logout() {
  await signOut();
  mq.reset();
}

Find the event

Open the person's profile and the event is on it. Your server can read the same profile with a secret key.

The profiles page shows how.

Send an email from your server

A secret key, which starts with mq_sec_, stays on your server. One call sends a transactional email.

import { MaqetinServer } from '@maqetin/sdk-js/server';

const mq = new MaqetinServer({ secretKey: process.env.MAQETIN_SECRET_KEY });
const { messageId } = await mq.messages.send({
  channel: 'email',
  templateId: 'tpl_receipt',
  to: { userId: 'u_42' }, // or { email: 'guest@example.com' }
  from: 'Harbour Money <receipts@mail.harbourmoney.co.uk>',
  data: { order: { id: 'o_42', total: 12.5 } },
  idempotencyKey: 'order-42:receipt',
});

The from address must be on a verified sending domain of your workspace.

The send API page lists every field.

Create a workspace and send your first event.