npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reviewo/tracker

v1.1.1

Published

SDK para envio de eventos de tracking para a API da Reviewo

Readme

@reviewo/tracker

SDK de tracking da Reviewo. O envio de eventos tem dois canais, espelhando a arquitetura do backend:

| Canal | Método | Endpoint | Onde rodar | Auth | | --- | --- | --- | --- | --- | | Público | reviewo.track.* | POST /api/v1/public/track | navegador ou backend | publishable key (metadata.siteKey) | | Sensível | reviewo.events.* | POST /api/v1/integration/events | somente backend | secret API key (x-api-key) |

⚠️ Compra, estorno e cancelamento são eventos sensíveis e sempre vão server-to-server, autenticados pela secret API key. Mesmo instalando o tracking via JavaScript/GTM, esses eventos nunca saem do navegador. O canal público recusa-os com um SensitiveEventError.

Instalação

npm install @reviewo/tracker
# ou: yarn add @reviewo/tracker

Canal público — navegação, carrinho e checkout

import { reviewo } from '@reviewo/tracker'

reviewo.configure({
  baseURL: 'https://www.api.reviewo.com.br',
  publishableKey: 'pk_rv_...', // vira metadata.siteKey
})

await reviewo.track.event({
  eventType: 'product_view',
  eventData: { productId: 'SKU-1', productName: 'Produto', price: 199.9 },
})

Eventos aceitos: page_view, product_view, add_to_cart, checkout_start, checkout_profile, checkout_shipping, checkout_payment, abandoned_cart, form_submit, custom_event.

Exemplos prontos em reviewo.track.examples.

Canal sensível — compra, estorno e cancelamento (backend)

import { reviewo } from '@reviewo/tracker'

reviewo.configure({
  baseURL: 'https://www.api.reviewo.com.br',
  apiKey: process.env.REVIEWO_SECRET_KEY!, // x-api-key — NUNCA no navegador
  accessKey: process.env.REVIEWO_ACCESS_KEY, // x-api-organization (opcional)
})

// Compra (atribuída pelo clickId do afiliado)
await reviewo.events.purchase({
  orderId: 'ORD-123',
  totalValue: 199.9,
  currency: 'BRL',
  clickId: 'CLICK_DO_AFILIADO',
  items: [{ sku: 'SKU-1', name: 'Produto', price: 199.9, quantity: 1 }],
})

// Estorno parcial (total quando sem refundValue)
await reviewo.events.refund({ orderId: 'ORD-123', refundValue: 50, reason: 'Estorno parcial' })

// Cancelamento
await reviewo.events.cancel({ orderId: 'ORD-123', reason: 'Cancelado pelo cliente' })

Idempotência

Cada evento é idempotente por idempotencyKey (header x-idempotency-key). Quando você não informa uma, o SDK deriva ${eventType}:${orderId} — igual ao backend. Reenvios do mesmo evento respondem { idempotent: true } sem reaplicar.

Resposta

const res = await reviewo.events.purchase({ orderId, totalValue, clickId })
// res.applied  → true quando o efeito foi aplicado (status 'processed')
// res.status   → 'processed' | 'ignored'
// res.reason   → 'no_attribution' | 'order_not_found' | 'order_already_exists' | ...

Configuração

reviewo.configure(options) (campos ausentes preservam o valor atual):

| Opção | Header / uso | Default | | --- | --- | --- | | baseURL | base das URLs | https://www.api.reviewo.com.br | | publishableKey | metadata.siteKey (público) | — | | apiKey | x-api-key (sensível) | — | | accessKey | x-api-organization (sensível, opcional) | — |