The payload should be a JSON object with the following fields:
-
"name" (string): The name of the event.
-
"properties" (object): The properties of the event.
- "timestamp" (string): The timestamp of the event in ISO
- 8601 format.
+ "type" (string): track | identify | alias | increment |
+ decrement
+
+
"payload.name" (string): The name of the event.
+
+ "payload.properties" (object): The properties of the
+ event.
@@ -230,7 +238,7 @@ app.use(
app.get('/sign-up', (req, res) => {
// track sign up events
- req.op.event('sign-up', {
+ req.op.track('sign-up', {
email: req.body.email,
});
res.send('Hello World');
@@ -269,13 +277,13 @@ const op = new OpenPanel({
code={`import { op } from './openpanel';
// Sends an event with payload foo: bar
-op.event('my_event', { foo: 'bar' });
+op.track('my_event', { foo: 'bar' });
// Identify with profile id
-op.setProfileId('123');
+op.identify({ profileId: '123' });
// or with additional data
-op.setProfile({
+op.identify({
profileId: '123',
firstName: 'John',
lastName: 'Doe',
@@ -283,12 +291,12 @@ op.setProfile({
});
// Increment a property
-op.increment('app_opened'); // increment by 1
-op.increment('app_opened', 5); // increment by 5
+op.increment({ name: 'app_opened', profile_id: '123' }); // increment by 1
+op.increment({ name: 'app_opened', profile_id: '123', value: 5 }); // increment by 5
// Decrement a property
-op.decrement('app_opened'); // decrement by 1
-op.decrement('app_opened', 5); // decrement by 5`}
+op.decrement({ name: 'app_opened', profile_id: '123' }); // decrement by 1
+op.decrement({ name: 'app_opened', profile_id: '123', value: 5 }); // decrement by 5`}
/>
);
@@ -309,9 +317,9 @@ npx expo install --pnpm expo-application expo-constants`}
environment. You should omit clientSecret if you use this on web!
Navigation
diff --git a/apps/docs/src/components/web-sdk-config.mdx b/apps/docs/src/components/web-sdk-config.mdx
index f5d5e432..3ffae7e9 100644
--- a/apps/docs/src/components/web-sdk-config.mdx
+++ b/apps/docs/src/components/web-sdk-config.mdx
@@ -1,6 +1,6 @@
##### Web options
-- `trackScreenViews` - If true, the library will automatically track screen views
-- `trackOutgoingLinks` - If true, the library will automatically track outgoing links
-- `trackAttributes` - If true, the library will automatically track attributes
+- `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 (``) (default: false)
diff --git a/apps/docs/src/pages/docs/migration/beta-v1.mdx b/apps/docs/src/pages/docs/migration/beta-v1.mdx
index 5e694626..1a53457d 100644
--- a/apps/docs/src/pages/docs/migration/beta-v1.mdx
+++ b/apps/docs/src/pages/docs/migration/beta-v1.mdx
@@ -30,6 +30,7 @@ op.screenView({ title: 'Home' }); // path will be what ever window.location.path
## Script tag
- New: `https://openpanel.dev/op1.js` should be used instead of `op.js` (note the filename)
+- Renamed: Tracking with attributes have changed. Use `data-track="my_event"` instead of `data-event="my_event"`
## @openpanel/nextjs