Playground features

Call tracking for ad campaigns

Twilio call tracking + dynamic number insertion

Tells you which advert produced which phone call, and records the ones nobody answered. For a business whose customers ring rather than fill in a form.

Three colored billboards each running a matching cord down to one telephone, with one cord dimmed and its receiver lying off the cradle

A feature of the Playground

This is a feature of the Vibe Coder Playground. It runs inside the Playground, with its audit record and its caveats beside it.

Download the Playground See pricing

The mistake it removes

Three ways this is normally got wrong, all of them expensive. (1) No webhook signature validation: the URL is public, and an unvalidated voice handler will dial whatever a stranger POSTs to it, on your account. (2) Swapping the number everywhere: local ranking depends on the name/address/phone matching your Google Business Profile and every directory, so a footer swap damages the thing being measured. (3) Recording without consent: several states, Florida and California among them, require every party to agree.

What is already handled

Every item here is checked by running the block’s own tests every time its checks run. An item tested only in part says so in its label. Tested means the block’s own test suite runs that code. It does not mean a live run against an outside service such as a payment provider.

What the audit found

Named rather than summarized. The reasoning behind each one ships inside the block, so it travels with the code instead of living on a page you have to trust. A finding marked fixed was fixed after the audit ran; the verdict above is still the one the audit gave.

One more finding is written in the auditors' internal shorthand, so it is not listed here. The full text is in the report inside the block. It was fixed after the audit, in d3e82c3ef.

What you still have to do

The feature cannot own your secrets, your host or your legal obligations. This is the part it deliberately does not claim.

What lands in your project

php

  • php/twilio-signature.php
  • php/twilio-number.php
  • php/twilio-voice.php
  • php/twilio-status.php

For shared hosting: cPanel, GoDaddy, anything with PHP 8 and no Node. WHERE TO UPLOAD: put all four files straight into public_html (public_html/twilio-status.php and its three siblings, not a subfolder of it). LOG_DIR is __DIR__/../call-log, so that layout writes the log to call-log beside public_html, one level above it, where the web server does not serve it. Upload them into a subfolder such as public_html/twilio/ and ../call-log becomes public_html/call-log, inside the served tree; twilio-status.php checks LOG_DIR against DOCUMENT_ROOT on every request and answers 500 rather than write there. If your host cannot take files at the top of public_html, set LOG_DIR to an absolute path outside it. A log folder that cannot be created or written is also answered 500, with one line naming LOG_DIR, so the Twilio debugger shows it instead of every call being dropped quietly. Set the constants at the top of each handler, and point the Twilio number at the public URLs. twilio-signature.php is required by both handlers and is the security boundary; twilio-number.php holds the phone-number grammar, the self-forward decision AND the value that gets dialed, and twilio-voice.php requires it: do not deploy a handler without either. The grammar lives in its own file so a test can execute it: before that split the decision was buried in the handler beside header() and $_POST, nothing could run it, and this stack quietly kept a defect the Node stack had fixed. No composer, no dependencies, stdlib only. ext-intl is OPTIONAL: with it, full-width digits are normalized and recognized; without it they are refused as a format error, which is the fail-closed direction.

node

  • node/twilio-voice.js

Serverless-style default export (Vercel-shaped). ESM, because a CommonJS module.exports in a "type": "module" repo parses cleanly and exports nothing. Config from the environment. signatureOk is exported separately so it can be tested without a live call. No dependencies: the signature is node:crypto, not the twilio SDK.

vanilla

  • vanilla/dni.js

Dynamic number insertion. Put the script tag at the end of <body> or add defer to it; a plain tag in <head> works too, because the swap waits for DOMContentLoaded while the page is still loading. Swaps only elements carrying data-dni, so anything you forget to mark keeps the real number: the safe direction. Source is decided once per session, because document.referrer is empty by the time a visitor on their fourth page decides to call. A visit that arrives with NO referrer is bucketed `no-referrer`, never `direct`: an empty field is what a messaging app, an email client, a rel="noreferrer" link, a strict Referrer-Policy and an https-to-http hop all produce, and only one of them is somebody typing your name. Map that bucket to a number and dark-social callers become countable instead of invisible.

What you supply

Get it

Download the Playground See pricing

A feature of the Vibe Coder Playground.

Questions

Is Call tracking for ad campaigns audited?
It was audited on 2026-09-29, and the verdict was not a clean pass. 7 findings have been fixed since then, and the verdict stands until the block is audited again.
What do I still have to do myself?
Serve the webhook over HTTPS at the EXACT url configured in the Twilio console, and keep TWILIO_AUTH_TOKEN in your host's environment. Signature validation is shipped and tested both directions, but it validates against the url you configure: rebuilding that url from request headers hands an attacker control of the signed string.
How do I get this?
It is a feature of the Vibe Coder Playground. Download the Playground, and see the pricing page for what each plan includes.

All Playground features · Free code blocks · Learn to build from zero · The coding guide