add nextjs with approuter example

This commit is contained in:
goenning 2023-08-31 16:16:38 +01:00
parent 7c9dc72df1
commit 90317d71d3
18 changed files with 623 additions and 2040 deletions

View file

@ -1,3 +0,0 @@
node_modules
dist
.DS_Store

View file

@ -13,11 +13,7 @@ A tiny SDK (1 kB) to instrument your web app with Aptabase, an Open Source, Priv
Install the SDK using your preferred JavaScript package manager
```bash
pnpm add @aptabase/web
# or
npm add @aptabase/web
# or
yarn add @aptabase/web
```
## Usage
@ -27,9 +23,9 @@ First you need to get your `App Key` from Aptabase, you can find it in the `Inst
Initialized the SDK using your `App Key`:
```js
import { init } from "@aptabase/web";
import { init } from '@aptabase/web';
init("<YOUR_APP_KEY>"); // 👈 this is where you enter your App Key
init('<YOUR_APP_KEY>'); // 👈 this is where you enter your App Key
```
The init function also supports an optional second parameter, which is an object with the `appVersion` property.
@ -39,10 +35,10 @@ It's up to you to decide what to get the version of your app, but it's generally
Afterwards you can start tracking events with `trackEvent`:
```js
import { trackEvent } from "@aptabase/web";
import { trackEvent } from '@aptabase/web';
trackEvent("connect_click"); // An event with no properties
trackEvent("play_music", { name: "Here comes the sun" }); // An event with a custom property
trackEvent('connect_click'); // An event with no properties
trackEvent('play_music', { name: 'Here comes the sun' }); // An event with a custom property
```
A few important notes:

View file

@ -27,8 +27,8 @@
"scripts": {
"build": "rollup -c ./rollup.config.mjs",
"watch": "rollup -c ./rollup.config.mjs -w",
"prepublishOnly": "yarn build",
"pretest": "yarn build"
"prepublishOnly": "npm run build",
"pretest": "npm run build"
},
"files": [
"README.md",
@ -38,10 +38,10 @@
],
"devDependencies": {
"@rollup/plugin-replace": "5.0.2",
"@rollup/plugin-typescript": "11.1.0",
"rollup": "3.21.6",
"@rollup/plugin-terser": "0.4.1",
"tslib": "2.5.0",
"typescript": "5.0.4"
"@rollup/plugin-typescript": "11.1.3",
"rollup": "3.28.1",
"@rollup/plugin-terser": "0.4.3",
"tslib": "2.6.2",
"typescript": "5.2.2"
}
}