Skip to content

Quickstart

Once you have reviewed which events to track, you can use one of our SDK's in your application to start tracking events.

Install SDK

Firstly you need to install one of our SDK's (Python, Node.js, Javascript Web) in your application:

npm i @trubrics/trubrics
pip install trubrics-beta

Initialise SDK and authenticate with Trubrics

Now ensure that Trubrics is imported & initialised in your app:

import { Trubrics } from "@trubrics/trubrics";

export const trubrics = new Trubrics({apiKey: TRUBRICS_API_KEY});
from trubrics_beta import Trubrics

trubrics = Trubrics(api_key="TRUBRICS_API_KEY")

API key

Your trubrics API key is unique to your project. Login to Trubrics, and copy your project API key from the settings page. This is a write only API key that allows you to push events.

Track user events (Sign Up, Conversion, etc.)

trubrics.track({
    event: "Sign Up",
    userId: "user_id",
    properties: {
        country: "USA",
        company: "Acme",  // Add more properties as needed
    },
});
trubrics.track(
    event="Sign Up",
    user_id="user_id",
    properties={
        "country": "USA",
        "company": "Acme",  # Add more properties as needed
    },
)

For more information on SDK's and how to track events, please refer to the SDK documentation.

Track AI events (Prompts, Generations, etc.)

If you are using Open AI, you can start tracking prompts and generations by adding a single line to your OpenAI initializer:

import OpenAI from "openai";

const openai = new OpenAI({
    apiKey: OPENAI_API_KEY,
    fetch: trubrics.openaiFetch, // (1)!
});
  1. Just add this single line!
# Coming soon