1.2.0 β’ Published 1 year ago
zaraz-ts v1.2.0
Zaraz TS
A type-safe wrapper around the Cloudflare Zaraz Web API.
- Basic types for
zaraz.track()
; - Basic types for
zaraz.set()
; - Extensive types for
zaraz.ecommerce()
; - Cheks for
zaraz
being available in the window.
Usage π§βπ»
Import zaraz and call the desired method. That's it!
import { zaraz } from 'zaraz-ts';
// Track custom events on your website, that might happen in real time.
await zaraz.track("button clicked", { userId: "ABC-123", value: 200 })
import { zaraz } from 'zaraz-ts';
// Make a variable available in all your events without manually setting it
// every time you are using zaraz.track().
zaraz.set('user_id', '123456');
import { zaraz } from 'zaraz-ts';
// Track common events of the e-commerce user journey, such as when a user adds
// a product to cart, starts the checkout funnel or completes an order.
await zaraz.ecommerce('Order Completed', {
checkout_id: '616727740',
order_id: '817286897056801',
affiliation: 'affiliate.com',
total: 30.0,
revenue: 20.0,
shipping: 3,
tax: 2,
discount: 5,
coupon: 'winter-sale',
currency: 'USD',
products: [
{
product_id: '999666321',
sku: '8251511',
name: 'Boyβs shorts',
price: 10,
quantity: 2,
category: 'shorts',
},
{
product_id: '742566131',
sku: '7251567',
name: 'Blank T-shirt',
price: 5,
quantity: 2,
category: 'T-shirts',
},
],
});
Checkout the official Cloudflare docs for more details: https://developers.cloudflare.com/zaraz/web-api/.
Maintenance π·
This package is maintained and actively used by Expatfile.tax. The #1 US expat tax e-filing software. πΊπΈ
1.3.0-alpha.1
1 year ago
1.2.0
1 year ago
1.2.0-alpha.2
1 year ago
1.2.0-alpha.1
1 year ago
1.1.1-alpha.1
1 year ago
1.1.0
1 year ago
1.1.0-alpha.1
1 year ago
1.0.3-alpha.1
1 year ago
1.0.2
2 years ago
1.0.2-alpha.2
2 years ago
1.0.2-alpha.1
2 years ago
1.0.1
2 years ago