From e4eb697b47e06c6df8ef926307c1e4a6e00ad5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carl-Gerhard=20Lindesva=CC=88rd?= Date: Wed, 7 Aug 2024 22:39:16 +0200 Subject: [PATCH] fix instructions --- apps/dashboard/src/modals/Instructions.tsx | 76 ++++++++++--------- apps/docs/src/components/web-sdk-config.mdx | 6 +- .../docs/src/pages/docs/migration/beta-v1.mdx | 1 + 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/apps/dashboard/src/modals/Instructions.tsx b/apps/dashboard/src/modals/Instructions.tsx index 7958923b..1de4de33 100644 --- a/apps/dashboard/src/modals/Instructions.tsx +++ b/apps/dashboard/src/modals/Instructions.tsx @@ -64,16 +64,13 @@ const Instructions = ({ framework, client }: Props) => {

Copy the code below and insert it to you website

-`} + });`} /> @@ -89,14 +86,14 @@ const Instructions = ({ framework, client }: Props) => {

Install dependencies

-

Add OpenpanelProvider to your root layout

+

Add OpenPanelComponent to your root layout

- { track custom events.

@@ -182,19 +179,30 @@ $openpanel->event( Usage

Create a custom event called "my_event".

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 (`