@flightdev/analytics 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -16
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @flightdev/analytics
|
|
2
2
|
|
|
3
3
|
Privacy-focused, universal analytics for Flight Framework. Works with any analytics provider through adapters.
|
|
4
4
|
|
|
@@ -33,7 +33,7 @@ Privacy-focused, universal analytics for Flight Framework. Works with any analyt
|
|
|
33
33
|
## Installation
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
npm install @
|
|
36
|
+
npm install @flightdev/analytics
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
---
|
|
@@ -41,8 +41,8 @@ npm install @flight-framework/analytics
|
|
|
41
41
|
## Quick Start
|
|
42
42
|
|
|
43
43
|
```typescript
|
|
44
|
-
import { createAnalytics } from '@
|
|
45
|
-
import { plausible } from '@
|
|
44
|
+
import { createAnalytics } from '@flightdev/analytics';
|
|
45
|
+
import { plausible } from '@flightdev/analytics/plausible';
|
|
46
46
|
|
|
47
47
|
const analytics = createAnalytics(plausible({
|
|
48
48
|
domain: 'example.com',
|
|
@@ -67,7 +67,7 @@ analytics.identify('user_123', { email: 'user@example.com' });
|
|
|
67
67
|
Simple, privacy-friendly analytics without cookies.
|
|
68
68
|
|
|
69
69
|
```typescript
|
|
70
|
-
import { plausible } from '@
|
|
70
|
+
import { plausible } from '@flightdev/analytics/plausible';
|
|
71
71
|
|
|
72
72
|
const adapter = plausible({
|
|
73
73
|
domain: 'example.com',
|
|
@@ -81,7 +81,7 @@ const adapter = plausible({
|
|
|
81
81
|
Full-featured product analytics with session recording.
|
|
82
82
|
|
|
83
83
|
```typescript
|
|
84
|
-
import { posthog } from '@
|
|
84
|
+
import { posthog } from '@flightdev/analytics/posthog';
|
|
85
85
|
|
|
86
86
|
const adapter = posthog({
|
|
87
87
|
apiKey: process.env.POSTHOG_API_KEY,
|
|
@@ -94,7 +94,7 @@ const adapter = posthog({
|
|
|
94
94
|
### Google Analytics 4
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
|
-
import { ga4 } from '@
|
|
97
|
+
import { ga4 } from '@flightdev/analytics/ga4';
|
|
98
98
|
|
|
99
99
|
const adapter = ga4({
|
|
100
100
|
measurementId: 'G-XXXXXXXXXX',
|
|
@@ -105,7 +105,7 @@ const adapter = ga4({
|
|
|
105
105
|
### Mixpanel
|
|
106
106
|
|
|
107
107
|
```typescript
|
|
108
|
-
import { mixpanel } from '@
|
|
108
|
+
import { mixpanel } from '@flightdev/analytics/mixpanel';
|
|
109
109
|
|
|
110
110
|
const adapter = mixpanel({
|
|
111
111
|
token: process.env.MIXPANEL_TOKEN,
|
|
@@ -116,7 +116,7 @@ const adapter = mixpanel({
|
|
|
116
116
|
### Amplitude
|
|
117
117
|
|
|
118
118
|
```typescript
|
|
119
|
-
import { amplitude } from '@
|
|
119
|
+
import { amplitude } from '@flightdev/analytics/amplitude';
|
|
120
120
|
|
|
121
121
|
const adapter = amplitude({
|
|
122
122
|
apiKey: process.env.AMPLITUDE_API_KEY,
|
|
@@ -129,7 +129,7 @@ const adapter = amplitude({
|
|
|
129
129
|
Send events to multiple providers simultaneously:
|
|
130
130
|
|
|
131
131
|
```typescript
|
|
132
|
-
import { multi } from '@
|
|
132
|
+
import { multi } from '@flightdev/analytics/multi';
|
|
133
133
|
|
|
134
134
|
const analytics = createAnalytics(multi([
|
|
135
135
|
plausible({ domain: 'example.com' }),
|
|
@@ -201,7 +201,7 @@ analytics.reset();
|
|
|
201
201
|
Wrap your app with the provider:
|
|
202
202
|
|
|
203
203
|
```tsx
|
|
204
|
-
import { AnalyticsProvider } from '@
|
|
204
|
+
import { AnalyticsProvider } from '@flightdev/analytics/react';
|
|
205
205
|
|
|
206
206
|
function App() {
|
|
207
207
|
return (
|
|
@@ -215,7 +215,7 @@ function App() {
|
|
|
215
215
|
### useAnalytics Hook
|
|
216
216
|
|
|
217
217
|
```tsx
|
|
218
|
-
import { useAnalytics } from '@
|
|
218
|
+
import { useAnalytics } from '@flightdev/analytics/react';
|
|
219
219
|
|
|
220
220
|
function SignupButton() {
|
|
221
221
|
const { trackEvent } = useAnalytics();
|
|
@@ -233,7 +233,7 @@ function SignupButton() {
|
|
|
233
233
|
Automatic page view tracking:
|
|
234
234
|
|
|
235
235
|
```tsx
|
|
236
|
-
import { usePageview } from '@
|
|
236
|
+
import { usePageview } from '@flightdev/analytics/react';
|
|
237
237
|
|
|
238
238
|
function Page() {
|
|
239
239
|
usePageview(); // Tracks on mount and route changes
|
|
@@ -247,7 +247,7 @@ function Page() {
|
|
|
247
247
|
Declarative event tracking:
|
|
248
248
|
|
|
249
249
|
```tsx
|
|
250
|
-
import { TrackEvent } from '@
|
|
250
|
+
import { TrackEvent } from '@flightdev/analytics/react';
|
|
251
251
|
|
|
252
252
|
function PricingPage() {
|
|
253
253
|
return (
|
|
@@ -266,7 +266,7 @@ function PricingPage() {
|
|
|
266
266
|
Track events from your server or API routes:
|
|
267
267
|
|
|
268
268
|
```typescript
|
|
269
|
-
import { createServerAnalytics } from '@
|
|
269
|
+
import { createServerAnalytics } from '@flightdev/analytics/server';
|
|
270
270
|
|
|
271
271
|
const serverAnalytics = createServerAnalytics(posthog({
|
|
272
272
|
apiKey: process.env.POSTHOG_API_KEY,
|
|
@@ -313,7 +313,7 @@ if (analytics.hasConsent()) {
|
|
|
313
313
|
### React Consent Hook
|
|
314
314
|
|
|
315
315
|
```tsx
|
|
316
|
-
import { useConsent } from '@
|
|
316
|
+
import { useConsent } from '@flightdev/analytics/react';
|
|
317
317
|
|
|
318
318
|
function CookieBanner() {
|
|
319
319
|
const { hasConsent, setConsent } = useConsent();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flightdev/analytics",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Agnostic analytics for Flight Framework. Choose your backend: Plausible, Umami, PostHog, or custom.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
"vitest": "^2.0.0"
|
|
27
27
|
},
|
|
28
28
|
"license": "MIT",
|
|
29
|
+
"homepage": "https://github.com/EliosLT/FlightDev",
|
|
30
|
+
"repository": {
|
|
31
|
+
"url": "https://github.com/EliosLT/FlightDev.git",
|
|
32
|
+
"directory": "packages/analytics",
|
|
33
|
+
"type": "git"
|
|
34
|
+
},
|
|
29
35
|
"scripts": {
|
|
30
36
|
"build": "tsup",
|
|
31
37
|
"test": "vitest run",
|