@aacigroup/aaci_shared 2.1.0 → 2.1.1
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 +42 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,10 +23,29 @@ const leadTracker = new LeadTracker({
|
|
|
23
23
|
productionDomains: ['myproject.com']
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
// Track lead only (session data automatically added)
|
|
27
|
+
await leadTracker.trackLeadAndAddress({
|
|
27
28
|
lead_type: 'signup',
|
|
28
29
|
email: 'user@example.com',
|
|
29
|
-
|
|
30
|
+
first_name: 'John',
|
|
31
|
+
last_name: 'Doe'
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Track address only (will merge with saved lead if exists)
|
|
35
|
+
await leadTracker.trackLeadAndAddress(undefined, {
|
|
36
|
+
full_address: '123 Main St, New York, NY 10001'
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Track both lead and address together
|
|
40
|
+
await leadTracker.trackLeadAndAddress({
|
|
41
|
+
lead_type: 'purchase',
|
|
42
|
+
email: 'user@example.com',
|
|
43
|
+
phone: '+1234567890'
|
|
44
|
+
}, {
|
|
45
|
+
full_address: '123 Main St, New York, NY 10001',
|
|
46
|
+
city: 'New York',
|
|
47
|
+
state: 'NY',
|
|
48
|
+
zip_code: '10001'
|
|
30
49
|
});
|
|
31
50
|
```
|
|
32
51
|
|
|
@@ -69,38 +88,37 @@ console.log('Is production:', env.isProduction());
|
|
|
69
88
|
|
|
70
89
|
## Features
|
|
71
90
|
|
|
72
|
-
- **
|
|
73
|
-
- **
|
|
74
|
-
- **Built-in Error Tracking** - Error tracking integrated with PostHog
|
|
91
|
+
- **Single Unified API** - One method handles all tracking scenarios
|
|
92
|
+
- **Automatic Session Tracking** - Session data automatically included
|
|
75
93
|
- **TypeScript Support** - Full type definitions
|
|
76
94
|
- **Framework Agnostic** - Works with any JS framework
|
|
77
|
-
- **Lovable.dev Compatible** -
|
|
95
|
+
- **Lovable.dev Compatible** - No environment variables needed
|
|
78
96
|
|
|
79
97
|
## API Reference
|
|
80
98
|
|
|
81
99
|
### LeadTracker
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
```javascript
|
|
101
|
+
// Track lead only
|
|
102
|
+
await tracker.trackLeadAndAddress({ lead_type: 'contact', email: 'user@example.com' });
|
|
103
|
+
|
|
104
|
+
// Track address only
|
|
105
|
+
await tracker.trackLeadAndAddress(undefined, { full_address: '123 Main St' });
|
|
106
|
+
|
|
107
|
+
// Track both together
|
|
108
|
+
await tracker.trackLeadAndAddress(leadData, addressData);
|
|
109
|
+
```
|
|
86
110
|
|
|
87
111
|
### PostHog
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
- `trackAPIError(url, status, message)` - Track API errors
|
|
112
|
+
```javascript
|
|
113
|
+
await analytics.init();
|
|
114
|
+
analytics.trackEvent('event_name', { property: 'value' });
|
|
115
|
+
analytics.trackError(error, 'context');
|
|
116
|
+
```
|
|
94
117
|
|
|
95
118
|
### GTM
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
### Environment
|
|
101
|
-
- `new Environment(config)` - Initialize with production domains
|
|
102
|
-
- `isProduction()` - Check if current domain is production
|
|
103
|
-
- `getCurrentDomain()` - Get current domain
|
|
119
|
+
```javascript
|
|
120
|
+
gtm.trackEvent('event_name', { property: 'value' });
|
|
121
|
+
```
|
|
104
122
|
|
|
105
123
|
## License
|
|
106
124
|
|