@entrolytics/vue-sdk 2.2.0 → 3.0.2

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 CHANGED
@@ -1,10 +1,10 @@
1
1
  <div align="center">
2
- <img src="https://raw.githubusercontent.com/entrolytics/.github/main/media/entrov2.png" alt="Entrolytics" width="64" height="64">
2
+ - <img src="https://raw.githubusercontent.com/entrolytics/.github/main/media/entrov2.png" alt="Entrolytics" width="64" height="64">
3
3
 
4
- [![npm](https://img.shields.io/npm/v/@entrolytics/vue-sdk.svg?logo=npm)](https://www.npmjs.com/package/@entrolytics/vue-sdk)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-3178C6.svg?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
- [![Vue](https://img.shields.io/badge/Vue-3.3+-4FC08D.svg?logo=vue.js&logoColor=white)](https://vuejs.org/)
4
+ [![npm](https://img.shields.io/npm/v/@entrolytics/vue-sdk.svg?logo=npm)](https://www.npmjs.com/package/@entrolytics/vue-sdk)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-3178C6.svg?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
7
+ [![Vue](https://img.shields.io/badge/Vue-3.3+-4FC08D.svg?logo=vue.js&logoColor=white)](https://vuejs.org/)
8
8
 
9
9
  </div>
10
10
 
@@ -15,6 +15,7 @@
15
15
  **@entrolytics/vue-sdk** is the official Vue SDK for Entrolytics - first-party growth analytics for the edge. Add powerful analytics to your Vue 3 applications with zero configuration.
16
16
 
17
17
  **Why use this SDK?**
18
+
18
19
  - Zero-config setup with automatic environment detection
19
20
  - Full Vue 3 Composition API support with composables
20
21
  - TypeScript-first with complete type definitions
@@ -27,6 +28,7 @@
27
28
  <td width="50%">
28
29
 
29
30
  ### Analytics
31
+
30
32
  - Automatic page view tracking
31
33
  - Custom event tracking
32
34
  - User identification
@@ -36,6 +38,7 @@
36
38
  <td width="50%">
37
39
 
38
40
  ### Developer Experience
41
+
39
42
  - Vue plugin architecture
40
43
  - Composables API (`useTrackEvent`, `useIdentify`)
41
44
  - Global `$entrolytics` property
@@ -76,7 +79,9 @@ View analytics in dashboard
76
79
 
77
80
  ```bash
78
81
  npm install @entrolytics/vue-sdk
82
+
79
83
  # or
84
+
80
85
  pnpm add @entrolytics/vue-sdk
81
86
  ```
82
87
 
@@ -125,9 +130,6 @@ createEntrolytics({
125
130
  // Optional: Auto-track page views (default: true)
126
131
  autoTrack: true,
127
132
 
128
- // Optional: Use edge-optimized endpoints (default: true)
129
- useEdgeRuntime: true,
130
-
131
133
  // Optional: Respect Do Not Track (default: false)
132
134
  respectDnt: false,
133
135
 
@@ -136,43 +138,7 @@ createEntrolytics({
136
138
  });
137
139
  ```
138
140
 
139
- ### Runtime Configuration
140
-
141
- The `useEdgeRuntime` option controls which collection endpoint is used:
142
-
143
- **Edge Runtime (default)** - Optimized for speed and global distribution:
144
-
145
- ```ts
146
- createEntrolytics({
147
- websiteId: 'your-website-id',
148
- useEdgeRuntime: true // or omit (default)
149
- });
150
- ```
151
-
152
- - **Latency**: Sub-50ms response times globally
153
- - **Best for**: Production Vue applications, globally distributed users
154
- - **Endpoint**: Uses `/api/send-native` for edge-to-edge communication
155
- - **Limitations**: No ClickHouse export, basic geo data
156
-
157
- **Node.js Runtime** - Full-featured with advanced capabilities:
158
-
159
- ```ts
160
- createEntrolytics({
161
- websiteId: 'your-website-id',
162
- useEdgeRuntime: false
163
- });
164
- ```
165
-
166
- - **Features**: ClickHouse export, MaxMind GeoIP (city-level accuracy)
167
- - **Best for**: Self-hosted deployments, advanced analytics requirements
168
- - **Endpoint**: Uses `/api/send` for Node.js runtime
169
- - **Latency**: 50-150ms (regional)
170
-
171
- **When to use Node.js runtime**:
172
- - Self-hosted Vue deployments without edge runtime support
173
- - Applications requiring ClickHouse data export
174
- - Need for advanced geo-targeting with MaxMind
175
- - Custom server-side analytics workflows
141
+ The plugin loads the canonical `/script.js` tracker from the configured host.
176
142
 
177
143
  ## Composables
178
144
 
@@ -210,7 +176,7 @@ function handlePurchase() {
210
176
  track('purchase', {
211
177
  revenue: 99.99,
212
178
  currency: 'USD',
213
- product_id: 'pro-plan'
179
+ product_id: 'pro-plan',
214
180
  });
215
181
  }
216
182
  </script>
@@ -242,11 +208,11 @@ import { useIdentify } from '@entrolytics/vue';
242
208
  const { identify } = useIdentify();
243
209
 
244
210
  // When user logs in
245
- watch(user, (newUser) => {
211
+ watch(user, newUser => {
246
212
  if (newUser) {
247
213
  identify(newUser.id, {
248
214
  email: newUser.email,
249
- plan: newUser.subscription
215
+ plan: newUser.subscription,
250
216
  });
251
217
  }
252
218
  });
@@ -263,9 +229,9 @@ export default {
263
229
  methods: {
264
230
  trackClick() {
265
231
  this.$entrolytics.track('button_click');
266
- }
267
- }
268
- }
232
+ },
233
+ },
234
+ };
269
235
  </script>
270
236
  ```
271
237
 
@@ -274,10 +240,7 @@ export default {
274
240
  Full TypeScript support with exported types:
275
241
 
276
242
  ```ts
277
- import type {
278
- EntrolyticsOptions,
279
- EntrolyticsInstance
280
- } from '@entrolytics/vue';
243
+ import type { EntrolyticsOptions, EntrolyticsInstance } from '@entrolytics/vue';
281
244
  ```
282
245
 
283
246
  ## License
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Main composable for accessing Entrolytics functionality
3
+ *
4
+ * @example
5
+ * ```vue
6
+ * <script setup>
7
+ * import { useEntrolytics } from '@entrolytics/vue';
8
+ *
9
+ * const { track, identify, isLoaded } = useEntrolytics();
10
+ *
11
+ * function handleClick() {
12
+ * track('button_click', { variant: 'primary' });
13
+ * }
14
+ * </script>
15
+ * ```
16
+ */
17
+ export declare function useEntrolytics(): import("../plugin.js").EntrolyticsInstance;
18
+ //# sourceMappingURL=useEntrolytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useEntrolytics.d.ts","sourceRoot":"","sources":["../../src/composables/useEntrolytics.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,+CAE7B"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Composable for identifying users
3
+ *
4
+ * @example
5
+ * ```vue
6
+ * <script setup>
7
+ * import { watch } from 'vue';
8
+ * import { useIdentify } from '@entrolytics/vue';
9
+ *
10
+ * const { identify } = useIdentify();
11
+ * const user = useUser(); // Your auth composable
12
+ *
13
+ * watch(user, (newUser) => {
14
+ * if (newUser) {
15
+ * identify(newUser.id, {
16
+ * email: newUser.email,
17
+ * plan: newUser.subscription
18
+ * });
19
+ * }
20
+ * });
21
+ * </script>
22
+ * ```
23
+ */
24
+ export declare function useIdentify(): {
25
+ identify: (data: import("../plugin.js").EventData) => void;
26
+ };
27
+ //# sourceMappingURL=useIdentify.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIdentify.d.ts","sourceRoot":"","sources":["../../src/composables/useIdentify.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,WAAW;;EAM1B"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Composable for tracking custom events
3
+ *
4
+ * @example
5
+ * ```vue
6
+ * <script setup>
7
+ * import { useTrackEvent } from '@entrolytics/vue';
8
+ *
9
+ * const { track } = useTrackEvent();
10
+ *
11
+ * function handlePurchase() {
12
+ * track('purchase', { revenue: 99.99, currency: 'USD' });
13
+ * }
14
+ * </script>
15
+ * ```
16
+ */
17
+ export declare function useTrackEvent(): {
18
+ track: (eventName: string, eventData?: import("../plugin.js").EventData) => void;
19
+ };
20
+ //# sourceMappingURL=useTrackEvent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackEvent.d.ts","sourceRoot":"","sources":["../../src/composables/useTrackEvent.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa;;EAM5B"}
@@ -0,0 +1,19 @@
1
+ import type { EventData } from '../plugin.js';
2
+ /**
3
+ * Composable for tracking outbound link clicks
4
+ *
5
+ * @example
6
+ * ```vue
7
+ * <script setup>
8
+ * import { useTrackOutboundLink } from '@entrolytics/vue';
9
+ *
10
+ * const trackOutboundLink = useTrackOutboundLink();
11
+ *
12
+ * const handleExternalClick = (url: string) => {
13
+ * trackOutboundLink(url, { placement: 'footer' });
14
+ * };
15
+ * </script>
16
+ * ```
17
+ */
18
+ export declare function useTrackOutboundLink(): (url: string, data?: EventData) => void;
19
+ //# sourceMappingURL=useTrackOutboundLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackOutboundLink.d.ts","sourceRoot":"","sources":["../../src/composables/useTrackOutboundLink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,UAErB,MAAM,SAAS,SAAS,UAGtC"}
@@ -0,0 +1,30 @@
1
+ import { type Ref } from 'vue';
2
+ /**
3
+ * Composable for tracking page views with vue-router
4
+ *
5
+ * @example
6
+ * ```vue
7
+ * <script setup>
8
+ * import { useRoute } from 'vue-router';
9
+ * import { useTrackPageView } from '@entrolytics/vue';
10
+ *
11
+ * const route = useRoute();
12
+ * useTrackPageView(() => route.path);
13
+ * </script>
14
+ * ```
15
+ *
16
+ * @example
17
+ * ```vue
18
+ * <script setup>
19
+ * import { ref } from 'vue';
20
+ * import { useTrackPageView } from '@entrolytics/vue';
21
+ *
22
+ * const currentPath = ref('/');
23
+ * useTrackPageView(currentPath);
24
+ * </script>
25
+ * ```
26
+ */
27
+ export declare function useTrackPageView(pathSource: Ref<string> | (() => string), options?: {
28
+ immediate?: boolean;
29
+ }): void;
30
+ //# sourceMappingURL=useTrackPageView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackPageView.d.ts","sourceRoot":"","sources":["../../src/composables/useTrackPageView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAS,MAAM,KAAK,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,MAAM,CAAC,EACxC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,QAgBlC"}
@@ -0,0 +1,23 @@
1
+ import type { EventData } from '../plugin.js';
2
+ /**
3
+ * Composable for tracking revenue events
4
+ *
5
+ * @example
6
+ * ```vue
7
+ * <script setup>
8
+ * import { useTrackRevenue } from '@entrolytics/vue';
9
+ *
10
+ * const trackRevenue = useTrackRevenue();
11
+ *
12
+ * const handlePurchase = async (product) => {
13
+ * await processPayment();
14
+ * trackRevenue('purchase', product.price, 'USD', {
15
+ * productId: product.id,
16
+ * productName: product.name
17
+ * });
18
+ * };
19
+ * </script>
20
+ * ```
21
+ */
22
+ export declare function useTrackRevenue(): (eventName: string, revenue: number, currency?: string, data?: EventData) => void;
23
+ //# sourceMappingURL=useTrackRevenue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTrackRevenue.d.ts","sourceRoot":"","sources":["../../src/composables/useTrackRevenue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,gBAEV,MAAM,WAAW,MAAM,4BAA2B,SAAS,UAG/E"}