Skip to content

Commit a9b4412

Browse files
committed
chore: README.md
1 parent 8ff4c19 commit a9b4412

File tree

2 files changed

+2
-79
lines changed

2 files changed

+2
-79
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
./packages/nuxt/README.md

packages/nuxt/README.md

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
11
# Simple Analytics Nuxt Module
22

3-
[![npm version][npm-version-src]][npm-version-href]
4-
[![npm downloads][npm-downloads-src]][npm-downloads-href]
5-
[![License][license-src]][license-href]
6-
[![Nuxt][nuxt-src]][nuxt-href]
7-
83
A Nuxt module for integrating Simple Analytics with server-side tracking capabilities.
94

10-
- [ Release Notes](/CHANGELOG.md)
11-
- [🏀 Online playground](https://stackblitz.com/github/simpleanalytics/simpleanalytics-nuxt?file=playground%2Fapp.vue)
12-
13-
## Features
14-
15-
- 🚀 **Server-side tracking** - Track pageviews and events on the server
16-
- 🔒 **Privacy-focused** - Respects Do Not Track headers
17-
- 🎯 **UTM parameter tracking** - Automatic UTM parameter parsing
18-
- 🌍 **Proxy support** - Proxy Simple Analytics scripts through your domain
19-
- 📊 **Flexible configuration** - Customize tracking behavior
20-
- 🔧 **Auto-imports** - Functions automatically available in your app
21-
225
## Quick Setup
236

247
Install the module to your Nuxt application:
@@ -54,7 +37,6 @@ if (import.meta.server) {
5437
hostname: 'your-domain.com',
5538
metadata: {
5639
source: 'homepage',
57-
timestamp: new Date().toISOString()
5840
}
5941
})
6042
}
@@ -69,7 +51,7 @@ Track custom events from API routes or server-side code:
6951
// In a server API route
7052
export default defineEventHandler(async (event) => {
7153
await trackEvent('user_signup', {
72-
headers: event.headers,
54+
event,
7355
metadata: {
7456
source: 'registration_form',
7557
user_type: 'new'
@@ -79,32 +61,6 @@ export default defineEventHandler(async (event) => {
7961
return { success: true }
8062
})
8163
```
82-
83-
### Client-side Event Tracking
84-
85-
Track events from the client side:
86-
87-
```vue
88-
<script setup>
89-
const handleButtonClick = async () => {
90-
try {
91-
await $fetch('/api/track-event', {
92-
method: 'POST',
93-
body: {
94-
eventName: 'button_clicked',
95-
metadata: {
96-
button_id: 'cta_button',
97-
page: 'homepage'
98-
}
99-
}
100-
})
101-
} catch (error) {
102-
console.error('Failed to track event:', error)
103-
}
104-
}
105-
</script>
106-
```
107-
10864
## Configuration
10965

11066
### Module Options
@@ -164,9 +120,6 @@ export default defineNuxtConfig({
164120
```bash
165121
# Required: Your Simple Analytics hostname
166122
SIMPLE_ANALYTICS_HOSTNAME=your-domain.com
167-
168-
# Optional: Enable analytics in development
169-
ENABLE_ANALYTICS_IN_DEV=1
170123
```
171124

172125
## API Reference
@@ -196,37 +149,6 @@ Track a custom event on the server.
196149
- `ignoreMetrics` (object): Metrics to ignore for this event
197150
- `collectDnt` (boolean): Whether to collect data when DNT is enabled
198151

199-
## Development
200-
201-
<details>
202-
<summary>Local development</summary>
203-
204-
```bash
205-
# Install dependencies
206-
npm install
207-
208-
# Generate type stubs
209-
npm run dev:prepare
210-
211-
# Develop with the playground
212-
npm run dev
213-
214-
# Build the playground
215-
npm run dev:build
216-
217-
# Run ESLint
218-
npm run lint
219-
220-
# Run Vitest
221-
npm run test
222-
npm run test:watch
223-
224-
# Release new version
225-
npm run release
226-
```
227-
228-
</details>
229-
230152
## License
231153

232154
MIT License - see the [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)