@active-reach/web-sdk 1.0.0 → 1.1.0
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 +103 -0
- package/dist/aegis.min.js +1 -1
- package/dist/aegis.min.js.map +1 -1
- package/dist/{analytics-B11keZ55.mjs → analytics-pklAx2Nq.mjs} +167 -2
- package/dist/analytics-pklAx2Nq.mjs.map +1 -0
- package/dist/core/analytics.d.ts +3 -0
- package/dist/core/analytics.d.ts.map +1 -1
- package/dist/ecommerce/index.d.ts +46 -0
- package/dist/ecommerce/index.d.ts.map +1 -0
- package/dist/ecommerce/types.d.ts +77 -0
- package/dist/ecommerce/types.d.ts.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/dist/placements/AegisPlacementManager.d.ts +1 -1
- package/dist/placements/AegisPlacementManager.d.ts.map +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/analytics-B11keZ55.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -247,6 +247,109 @@ await aegis.flush();
|
|
|
247
247
|
|
|
248
248
|
---
|
|
249
249
|
|
|
250
|
+
## E-Commerce Tracking
|
|
251
|
+
|
|
252
|
+
Built-in helpers for standardized e-commerce events via `aegis.ecommerce`:
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
import aegis from '@active-reach/web-sdk';
|
|
256
|
+
|
|
257
|
+
// Product discovery
|
|
258
|
+
aegis.ecommerce.productViewed({
|
|
259
|
+
product_id: 'SKU-123',
|
|
260
|
+
name: 'Leather Jacket',
|
|
261
|
+
price: 4999,
|
|
262
|
+
currency: 'INR',
|
|
263
|
+
category: 'Outerwear',
|
|
264
|
+
brand: 'Acme',
|
|
265
|
+
variant_id: 'black_xl',
|
|
266
|
+
variant_label: 'Black XL',
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
aegis.ecommerce.productListViewed({
|
|
270
|
+
list_name: 'New Arrivals',
|
|
271
|
+
category: 'Outerwear',
|
|
272
|
+
products: [{ product_id: 'SKU-123', name: 'Leather Jacket', price: 4999 }],
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
aegis.ecommerce.searchPerformed({ query: 'leather jacket', results_count: 12 });
|
|
276
|
+
|
|
277
|
+
// Cart
|
|
278
|
+
aegis.ecommerce.addToCart({
|
|
279
|
+
product_id: 'SKU-123',
|
|
280
|
+
name: 'Leather Jacket',
|
|
281
|
+
price: 4999,
|
|
282
|
+
quantity: 1,
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
aegis.ecommerce.removeFromCart({ product_id: 'SKU-123', name: 'Leather Jacket', price: 4999 });
|
|
286
|
+
|
|
287
|
+
aegis.ecommerce.cartViewed({
|
|
288
|
+
cart_id: 'cart_456',
|
|
289
|
+
value: 4999,
|
|
290
|
+
products: [{ product_id: 'SKU-123', name: 'Leather Jacket', price: 4999, quantity: 1 }],
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
// Checkout
|
|
294
|
+
aegis.ecommerce.checkoutStarted({
|
|
295
|
+
value: 4999,
|
|
296
|
+
products: [{ product_id: 'SKU-123', name: 'Leather Jacket', price: 4999, quantity: 1 }],
|
|
297
|
+
coupon: 'WELCOME10',
|
|
298
|
+
shipping: 99,
|
|
299
|
+
tax: 450,
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
aegis.ecommerce.checkoutStep(2, { payment_method: 'UPI' });
|
|
303
|
+
|
|
304
|
+
// Order
|
|
305
|
+
aegis.ecommerce.orderCompleted({
|
|
306
|
+
order_id: 'ORD-789',
|
|
307
|
+
value: 5548,
|
|
308
|
+
revenue: 4999,
|
|
309
|
+
shipping: 99,
|
|
310
|
+
tax: 450,
|
|
311
|
+
payment_method: 'UPI',
|
|
312
|
+
products: [{ product_id: 'SKU-123', name: 'Leather Jacket', price: 4999, quantity: 1 }],
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
aegis.ecommerce.orderRefunded('ORD-789', 4999);
|
|
316
|
+
|
|
317
|
+
// Coupons
|
|
318
|
+
aegis.ecommerce.couponApplied({ coupon_code: 'WELCOME10', discount_value: 500, discount_type: 'fixed' });
|
|
319
|
+
aegis.ecommerce.couponRemoved({ coupon_code: 'WELCOME10' });
|
|
320
|
+
|
|
321
|
+
// Wishlist
|
|
322
|
+
aegis.ecommerce.wishlistItemAdded({
|
|
323
|
+
product: { product_id: 'SKU-123', name: 'Leather Jacket', price: 4999 },
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
// Promotions
|
|
327
|
+
aegis.ecommerce.promotionViewed({ name: 'Summer Sale', promotion_id: 'promo_1', creative: 'banner_hero' });
|
|
328
|
+
aegis.ecommerce.promotionClicked({ name: 'Summer Sale', promotion_id: 'promo_1' });
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### All E-Commerce Methods
|
|
332
|
+
|
|
333
|
+
| Method | Event Name | Description |
|
|
334
|
+
|--------|-----------|-------------|
|
|
335
|
+
| `productViewed(product)` | `product_viewed` | User views a product page |
|
|
336
|
+
| `productListViewed(list)` | `product_list_viewed` | User views a category/collection |
|
|
337
|
+
| `searchPerformed(search)` | `search_performed` | User searches the catalog |
|
|
338
|
+
| `addToCart(product)` | `cart_item_added` | Item added to cart |
|
|
339
|
+
| `removeFromCart(product)` | `cart_item_removed` | Item removed from cart |
|
|
340
|
+
| `cartViewed(cart)` | `cart_viewed` | User views their cart |
|
|
341
|
+
| `checkoutStarted(checkout)` | `checkout_started` | Checkout flow begins |
|
|
342
|
+
| `checkoutStep(step, options?)` | `checkout_step` | Checkout step completed |
|
|
343
|
+
| `orderCompleted(order)` | `order_completed` | Purchase completed |
|
|
344
|
+
| `orderRefunded(orderId, value?, products?)` | `order_refunded` | Order refunded |
|
|
345
|
+
| `couponApplied(coupon)` | `coupon_applied` | Coupon/discount applied |
|
|
346
|
+
| `couponRemoved(coupon)` | `coupon_removed` | Coupon removed |
|
|
347
|
+
| `wishlistItemAdded(wishlist)` | `wishlist_item_added` | Item added to wishlist |
|
|
348
|
+
| `promotionViewed(promo)` | `promotion_viewed` | Promotion impression |
|
|
349
|
+
| `promotionClicked(promo)` | `promotion_clicked` | Promotion clicked |
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
250
353
|
## React Hooks
|
|
251
354
|
|
|
252
355
|
Import from `@active-reach/web-sdk/react`:
|