@reservamos/browser-analytics 0.1.3 → 0.1.4-alpha.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/CHANGELOG.md CHANGED
@@ -1,6 +1,20 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.2.0
4
+
5
+ - Breaking Change: Import individual init, track and identify functions is no longer available.
6
+ - Breaking Change: The track events are now under the `track` property. So `analytics.trackEventName` now becomes `analytics.track.eventName`.
7
+ - Implement new folder structure.
8
+ - Add services
9
+ - Add a folder per event
10
+ - Refactor mixpanel, fingerprint and validator to become services
11
+
12
+ ## 0.1.3
13
+
14
+ - Added publish action
15
+
3
16
  ## 0.1.1
17
+
4
18
  - Added `zod` dependency to validate schema formats
5
19
 
6
20
  ## 0.1.0
package/README.md CHANGED
@@ -16,20 +16,14 @@ This library is a lightweight and optimized solution for tracking user events an
16
16
  To install the library, use npm or yarn
17
17
 
18
18
  ```bash
19
- npm install reservamos-browser-analytics
19
+ npm install @reservamos/browser-analytics
20
20
  ```
21
21
 
22
22
  ## Usage
23
23
 
24
24
  ```typescript
25
- // Import the tracker
26
- import tracker from '@reservamos/browser-analytics';
27
-
28
- // Also import the InitConfig interface if you want to use type safety
29
- // import tracker, { InitConfig } from "@reservamos/browser-analytics";
30
-
31
- // You can also import only the functions you need
32
- // import { init, track, identify } from "@reservamos/browser-analytics";
25
+ // Import the tracker and the InitConfig interface if you want to use type safety
26
+ import analytics, { InitConfig } from '@reservamos/browser-analytics';
33
27
 
34
28
  // Define the configuration for the tracker
35
29
  const config: InitConfig = {
@@ -39,13 +33,31 @@ const config: InitConfig = {
39
33
  };
40
34
 
41
35
  // Initialize the tracker with the config
42
- tracker.init(config);
36
+ analytics.init(config);
43
37
 
44
38
  // Listen for the "Tracker Ready" event
45
39
  window.addEventListener('Tracker Ready', () => {
46
40
  console.log('Tracker Ready');
47
41
 
48
42
  // Track a test event
49
- tracker.trackTest();
43
+ analytics.track.test();
44
+ });
45
+ ```
46
+
47
+ ## Identifying Users
48
+
49
+ The `identify` method accepts a main identifier and an object containing user information. The object has four predefined fields: `email`, `firstName`, `lastName`, and `phone`. In addition to these, you can include any custom fields to store additional user-specific information as needed.
50
+
51
+ ```typescript
52
+ import analytics from '@reservamos/browser-analytics';
53
+
54
+ // Identify the user with the main identifier and additional information
55
+
56
+ analytics.identify('main-identifier', {
57
+ email: 'example',
58
+ firstName: 'John',
59
+ lastName: 'Doe',
60
+ phone: '123456789',
61
+ salesforceId: '123456789',
50
62
  });
51
63
  ```