@openpanel/web
v1.0.7
Published
The OpenPanel Web SDK allows you to track user behavior on your website using a simple script tag. This guide provides instructions for installing and using the Web SDK in your project.
Downloads
68,772
Readme
Javascript (Web)
The OpenPanel Web SDK allows you to track user behavior on your website using a simple script tag. This guide provides instructions for installing and using the Web SDK in your project.
📖 Full documentation: https://openpanel.dev/docs/sdks/web
Installation
Step 1: Install
npm install @openpanel/webStep 2: Initialize
import { OpenPanel } from '@openpanel/web';
const op = new OpenPanel({
clientId: 'YOUR_CLIENT_ID',
trackScreenViews: true,
trackOutgoingLinks: true,
trackAttributes: true,
});Options
Common options
apiUrl- The url of the openpanel API or your self-hosted instanceclientId- The client id of your applicationclientSecret- The client secret of your application (only required for server-side events)filter- A function that will be called before sending an event. If it returns false, the event will not be sentdisabled- If true, the library will not send any events
Web options
trackScreenViews- If true, the library will automatically track screen views (default: false)trackOutgoingLinks- If true, the library will automatically track outgoing links (default: false)trackAttributes- If true, you can trigger events by using html attributes (<button type="button" data-track="your_event" />) (default: false)
Step 3: Usage
import { op } from './op.js';
op.track('my_event', { foo: 'bar' });Usage
Refer to the Javascript SDK for usage instructions.
