Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clutter/wt

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clutter/wt - npm Package Compare versions

Comparing version 2.0.0-rc.2 to 2.0.0

2

package.json
{
"name": "@clutter/wt",
"version": "2.0.0-rc.2",
"version": "2.0.0",
"scripts": {

@@ -5,0 +5,0 @@ "test": "jest",

@@ -18,10 +18,14 @@ # What is wt

Events can be tracked with the function `wt.track(kind: string, params: Record<string, any>)`.
For a single event, set `kind` to `'event'` and pass any parameters you want to track in `params`.
For instance:
Events can be tracked with the function `wt.track(params: WTEventParams & Record<string, any>)`.
```js
wt.track("event", { action: "hover" });
wt.track({ action: "hover" });
```
All events have a `kind` property that defaults to `"event"`. For events that don't require any additional data (e.g. pageview events), there is a simplified syntax to set _only_ the `kind` property:
```js
wt.track("pageview");
```
### Multiple events

@@ -32,5 +36,5 @@

```js
wt.track("event", { action: "hover" });
wt.track({ action: "hover" });
// after 0.2 seconds
wt.track("event", { action: "click" });
wt.track({ action: "click" });
```

@@ -44,10 +48,6 @@

### Pageviews
### Data
Events can be tracked without explicit parameters:
`wt` includes a list of recognized properties, detailed in `WTEventParams` (also see [Server Implementation](#server-implementation) below). Custom properties can also be tracked and will be grouped under a single `metadata` property.
```js
wt.track("pageview");
```
# React Integration

@@ -73,4 +73,3 @@

If
additional customization is desired, there is also a `createProvider` utility which allows for custom typing and added
If additional customization is desired, there is also a `createProvider` utility which allows for custom typing and added
event control. Each call to `createProvider` creates a new, distinct React context meaning that the returned hooks _will not work_ with the default `WTProvider`.

@@ -86,3 +85,3 @@

const { WTProvider, useTrack, useWT } = createProvider((params: EventParams) =>
wt.track("event", params)
wt.track(params)
);

@@ -164,3 +163,3 @@ ```

const { WTProvider } = createProvider((params) => wt.track("event", params), {
const { WTProvider } = createProvider((params) => wt.track(params), {
validateEvent,

@@ -261,4 +260,2 @@ });

{
// The first parameter passed to wt.track()
kind: 'event',
// The url of the page triggering the event

@@ -273,3 +270,4 @@ url: 'https://www.clutter.com/',

ts: '1634596872864'
// The second parameter passed to wt.track is merged into the event
// Known parameters passed to wt.track are converted to snake case and merged with the event
kind: 'event',
category: 'user_interaction',

@@ -285,3 +283,3 @@ action: 'click',

// Parameters not included in the above list will be grouped under
// a single metadata key
// a single metadata key (without any transformation).
metadata: {

@@ -288,0 +286,0 @@ variant: 'jungle',

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc