To install the @datafloww/analytics
package, run:
npm install @datafloww/analytics
To initialize the analytics library, import the Analytics
class and call the init
method with your write key:
import { Analytics } from "@datafloww/analytics";
const analytics = Analytics.init({ key: "YOUR_WRITE_KEY" });
You can now use the analytics
instance to track custom events. Here is an example:
// Example: Track a custom event
analytics.track("event_name", {
property1: "value1",
property2: "value2",
});