GithubHelp home page GithubHelp logo

zaraz-ts's Introduction

GitHub branch checks state codecov Known Vulnerabilities

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 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. πŸ‡ΊπŸ‡Έ

zaraz-ts's People

Contributors

hofmannz avatar expatfile-bot avatar davevanhoorn avatar uralkrc avatar

Stargazers

Sean avatar Nick Stakenburg avatar Yo'av Moshe avatar Dillon Chanis avatar  avatar Shlomi Bazel avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.