Tags

Custom Events

Tracks and reports custom events.

Installation

Install the analytics npm package:

npm install nano-custom

Simple Usage

<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. This object can contain any custom fields you need.

track("ButtonClick", {
  category: "CTA",
  label: "Homepage Hero",
  value: 1
});

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

Custom Metadata Example

Edit on GitHub

Last updated on

On this page