Docs
Using an AI assistant? Ask it to read pegada.dev/llms.txt and set Pegada up in your project. In the dashboard, each site also has a "Copy instructions" button with the site id filled in.
Get started
Create an account, add a site with its domain and paste this line into the <head> of
every page (in the root layout, if there is one). The site id is in Settings.
<script defer src="https://pegada.dev/p.js" data-site="YOUR_SITE"></script>
It counts page views on its own, including SPA route changes. It uses no cookies and stores nothing in the browser, so no consent banner is needed. Events are only accepted from the domains registered for the site.
Browser events
Once the script loads, there is window.pegada.track(name, props):
window.pegada?.track("signup_completed", { plan: "pro", value: 49 });
- Name: letters, digits and
_ . : -, up to 50 characters. Prefer past-tense snake_case, likepurchase_completed. - Props: up to 20 per event. Keys use letters, digits and
_(up to 40). Values are text (up to 200), numbers or booleans. - Never send personal data (email, name, phone, ID numbers) in props.
Server events
For what only your backend knows, like a confirmed payment. Use the pegada SDK (no dependencies; Node 18+, Bun, Deno, Workers, Lambda) with a server key, created in the site's Settings and kept in an environment variable. The key is secret: never ship it to the browser.
npm install pegada
import { createPegada } from "pegada";
const pegada = createPegada({ key: process.env.PEGADA_KEY });
await pegada.track(
"payment_confirmed",
{ plan: "pro", value: 49 },
{ ip: request.ip, userAgent: request.headers["user-agent"] },
);
ipanduserAgentbelong to the person who acted. They link the event to that visit and are not stored.-
Webhooks (Stripe and so on), where the caller is not the person: in the browser, get
await window.pegada.visit()and store it with the order; in the webhook, send{ visit }instead of ip and user agent. The token lasts 30 days. - Optional:
path,at(up to 24 h ago) andcountry. Batches:pegada.trackMany([...]), up to 50. - The SDK never throws and gives up after 2 s: if Pegada goes down, your app keeps working.
From any other language, it is a POST:
POST https://pegada.dev/api/track
Authorization: Bearer pgd_sk_...
Content-Type: application/json
{ "name": "payment_confirmed", "props": { "plan": "pro" }, "ip": "...", "userAgent": "..." }
AI assistant (MCP)
The main way to read your data is to ask your assistant. The MCP server is at https://pegada.dev/api/mcp and
signs in with your account (OAuth): the assistant opens Pegada for you to approve.
claude mcp add --transport http pegada https://pegada.dev/api/mcp
In Cursor and other clients, add the same address as an HTTP MCP server. If the client does not sign in with OAuth, create a
token under Account in the dashboard and send it as Authorization: Bearer pgd_tk_.... A read token only reads; a
read-and-write token also changes funnels and replies to feedback. Sites, keys and tokens only change in the dashboard.
What you can ask: the overview for a period (get_stats), counts and breakdowns by any prop
(query_events), funnels per visitor or linked by a prop (funnel), retention, the latest events and
the site's feedback, which you can read and reply to. Answers come in Portuguese or English, following your question.
Feedback
A ready-made "Feedback" button in the corner of your site:
<script defer src="https://pegada.dev/f.js" data-site="YOUR_SITE"></script>
People pick problem, idea or other, write, can paste a screenshot and leave their email. After sending, the widget becomes a conversation: they see your reply there and can answer. For that, the widget stores only the conversation token in the browser, after the person sends something. Options:
| Attribute | What it does |
|---|---|
data-color="#hex" | Button color. |
data-lang="pt", "en", "es" or "ja" | Language. Default: the page's (it follows if the page switches language), then the browser's. |
data-position="left" | Left corner. |
data-button="false" | No floating button; open it with data-trigger="#selector" or window.pegadaFeedback.open(). |
data-chat="false" | No conversation: it only sends and stores nothing in the browser. |
data-email="ana@site.com" | Email already filled in, for signed-in users. Can be set after the script loads. |
The widget opens light or dark to match the page background.
Context: window.pegadaFeedback.context = () => ({ plan: "pro", screen: "/checkout" }) goes along with each
submission (shown as plan=pro · screen=/checkout). It can be a function, an object or a string, and can be set
before f.js loads.
New replies with data-button="false": the data-trigger elements get the
data-pegada-unread attribute (style it with CSS), and the window gets a pegada:feedback event with
detail.unread.
Your own form: with p.js, await window.pegada.feedback(message, { kind, email, image }). From the
server: POST /api/f with the site key and { kind, message, contact }.
AI agents that use your product send feedback through the site's public MCP server, with no sign-in:
https://pegada.dev/api/mcp/f/YOUR_SITE (tool send_feedback). It is worth mentioning that address in
your llms.txt or API docs.
Everything lands in the site's Feedback tab and in list_feedback over MCP. Reply from the dashboard, from your
assistant or by replying to the notification email; the reply reaches the sender in the widget and by email, if they left one.
Site email
Each site has an address at Pegada, like yoursite@inbox.pegada.dev (you can change the name in Settings).
Whatever arrives becomes feedback, and replies to your answers go back to the same conversation.
You can also use an address on your own domain, like support@yoursite.com. Pegada shows the DNS records (DKIM and
a domain proof) and your replies start going out from that address. To receive:
- If the domain has no email (no MX), it receives straight into Pegada with one extra MX record. It works as a contact form.
- If it already has email, forward the address to the site's Pegada address. You never need to change an existing MX.
Limits
- 10,000 accepted events per site per day (it can be raised: write to support@pegada.dev).
- Everything expires after 13 months.
- Bots and automated browsers are not counted.
- Feedback: up to 10 per visitor and 300 per site, per hour; 20 replies per conversation per hour in the widget.
Questions, bugs or ideas: the "Send feedback" link in the footer, send_feedback over MCP or
support@pegada.dev.