This page provides all the necessary steps and examples to get started with the NumiaEngage Attribution SDK, from installation to advanced usage.
Installation
Install the SDK using your preferred package manager:
# npm
npm install @numia/engage-sdk
# yarn
yarn add @numia/engage-sdk
# pnpm
pnpm add @numia/engage-sdk
Setup
To begin using the SDK, you need to create an instance of the analytics class. Obtain your API key from the Numia dashboard:
import { createEngage } from "@numia/engage-sdk";
const analytics = createEngage({
app: "soon-unicorn-app", // Your app name
apiKey: "MySecretWriteKey", // Replace with your WriteKey
test: true, // Set to false for production
});
app: The name of your application.apiKey: Your unique WriteKey obtained from the Numia dashboard.test: Optional. Set totruefor testing environments andfalsefor production.
Usage
Basic Tracking Methods
The SDK provides three core methods for tracking:
- Identify: Links events to a specific wallet address.
- Track: Records user actions with associated metadata.
- Page: Tracks page views and attribution parameters.
Example: Identify
analytics.identify({
address: "osmo1abc123...",
metadata: {
referrer: "twitter"
}
});
Example: Track
analytics.track("swap_completed", {
tokenIn: "OSMO",
tokenOut: "ATOM",
amount: 100
});
Example: Page
analytics.page({
path: "/swap",
title: "Token Swap"
});