Tags

Custom Events

Collects, processes, and reports custom events through its own privacy-focused API and infrastructure.

Usage

The nano-custom package allows you to track custom events with any metadata you need, securely, in your web application.

Installation

Install the nano-custom npm package:

npm install nano-custom

Embedding & Simple Usage

To enable custom event tracking, include the following in your top-level HTML (e.g., index.html):

<script>
  import { track } from "nano-custom";
</script>
 
<nano-custom
  userId="USER_ID"
  projectKey="PROJECT_KEY"
/>
 
<button onclick="track('SignUp')">
  Sign Up
</button>

Tracking with Metadata

You can enhance your event tracking by passing an object with additional metadata fields. This object can contain any custom fields you need.

The fields category, label, and value are predefined and, if included, will be displayed in your analytics dashboard.

track("ButtonClick", {
  category: "CTA",        // String
  label: "Homepage Hero", // String
  value: 1,               // Number
  {}                      // Add additional json
});

This additional metadata allows you to categorize and label your events for better analysis in the dashboard.

Custom Metadata Example

Edit on GitHub

Last updated on

On this page