Skip to content

Latest commit

 

History

History
54 lines (37 loc) · 1.06 KB

README.md

File metadata and controls

54 lines (37 loc) · 1.06 KB

umami-sdk

logo

Umami is a simple, fast, privacy-focused alternative to Google Analytics.

This is a browser client SDK for umami, writing in Typescript.

Before using

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.

How to use

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' })

License

MIT.