Package Exports
- zaraz-ts
- zaraz-ts/build/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zaraz-ts) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Zaraz TS
A type-safe wrapper around the Cloudflare Zaraz Web API.
- Basic types for
zaraz.track(); - Basic types for
zaraz.set(); - Basic types for
zaraz.consent(); - Extensive types for
zaraz.ecommerce(); - Cheks for
zarazbeing 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. πΊπΈ