Umami is a simple, fast, privacy-focused alternative to Google Analytics.
This is a browser client SDK for umami, writing in Typescript.
Before using this client sdk, please ensure that you have added your tracking code in your frontend project. It is something like this:
<html lang="en">
<head>
<title>umami.js</title>
<!-- ... -->
<script async defer data-website-id="<your-website-id>" src="<https://your-website.com>/umami.js"></script>
<!-- ... -->
</head>
<body>
<!-- ... -->
</body>
</html>
For more information, please refer to the official documentation.
First, install the package:
npm install -S umami-sdk
Then you can use it like this:
import { trackEvent } from 'umami-sdk'
// just report a custom event name
trackEvent('header-login-button')
// or together with some event data
trackEvent('header-login-button', { hello: 'world' })
MIT.