@aacigroup/aaci_shared 2.6.1 → 2.6.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 +33 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -237,26 +237,22 @@ const tracker = new LeadTracker({
|
|
|
237
237
|
apiUrl: 'https://your-api.com/leads',
|
|
238
238
|
apiKey: 'your-api-key',
|
|
239
239
|
projectName: 'MyProject',
|
|
240
|
-
productionDomains: ['myproject.com']
|
|
240
|
+
productionDomains: ['myproject.com', 'www.myproject.com']
|
|
241
|
+
// productionDomains: import.meta.env.VITE_PRODUCTION_DOMAINS.split(',')
|
|
241
242
|
});
|
|
242
243
|
|
|
243
244
|
// Initialize PostHog Analytics
|
|
244
245
|
const analytics = new PostHog({
|
|
245
246
|
apiKey: 'phc_your_key',
|
|
246
247
|
projectName: 'MyProject',
|
|
247
|
-
productionDomains: ['myproject.com']
|
|
248
|
+
productionDomains: ['myproject.com', 'www.myproject.com']
|
|
249
|
+
// productionDomains: import.meta.env.VITE_PRODUCTION_DOMAINS.split(',')
|
|
248
250
|
});
|
|
249
251
|
await analytics.init();
|
|
250
252
|
|
|
251
|
-
//
|
|
252
|
-
const gtm = new GTM({
|
|
253
|
-
productionDomains: ['myproject.com']
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
// Use the same trackLeadAndAddress method
|
|
253
|
+
// Use tracking methods
|
|
257
254
|
await tracker.trackLeadAndAddress(leadData, addressData);
|
|
258
255
|
analytics.trackEvent('custom_event', { data: 'value' });
|
|
259
|
-
gtm.trackEvent('purchase', { value: 100, currency: 'USD' });
|
|
260
256
|
```
|
|
261
257
|
|
|
262
258
|
### Input Validation (Optional)
|
|
@@ -298,6 +294,34 @@ if (result.success) {
|
|
|
298
294
|
}
|
|
299
295
|
```
|
|
300
296
|
|
|
297
|
+
### Environment Detection
|
|
298
|
+
|
|
299
|
+
```javascript
|
|
300
|
+
import { Environment } from '@aacigroup/aaci_shared';
|
|
301
|
+
|
|
302
|
+
const env = new Environment({
|
|
303
|
+
productionDomains: ['myproject.com', 'www.myproject.com']
|
|
304
|
+
// productionDomains: import.meta.env.VITE_PRODUCTION_DOMAINS.split(',')
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
if (env.isProduction()) {
|
|
308
|
+
// Production-specific code
|
|
309
|
+
}
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
### Google Tag Manager
|
|
313
|
+
|
|
314
|
+
```javascript
|
|
315
|
+
import { GTM } from '@aacigroup/aaci_shared';
|
|
316
|
+
|
|
317
|
+
const gtm = new GTM({
|
|
318
|
+
productionDomains: ['myproject.com', 'www.myproject.com']
|
|
319
|
+
// productionDomains: import.meta.env.VITE_PRODUCTION_DOMAINS.split(',')
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
gtm.trackEvent('purchase', { value: 100, currency: 'USD' });
|
|
323
|
+
```
|
|
324
|
+
|
|
301
325
|
### TypeScript Types
|
|
302
326
|
|
|
303
327
|
```javascript
|