@logeix/phone-intent
v1.0.1
Published
Heuristic phone call intent tracking for LOGEIX Astro + Cloudflare Pages sites
Readme
@logeix/phone-intent
Heuristic phone call intent tracking for LOGEIX client sites (Astro + Cloudflare Pages + D1).
Records tap and resolve events when visitors click tel: links, estimates likely call duration via wall-clock watch + engagement signals, and stores rows in each site's D1 database.
Install
Public GitHub release tarball — no PAT, no .npmrc, no git/SSH:
"@logeix/phone-intent": "https://github.com/logeix/phone-intent/archive/refs/tags/v1.0.1.tar.gz"npm installWorks on Cloudflare Pages CI with zero secrets. Bump the tag URL when releasing (e.g. v1.0.2).
Optional: after npm login on npmjs.com, publish with npm publish --access public and sites can use "@logeix/phone-intent": "^1.0.1" instead.
The repo and package are public but unlisted — hard to find unless you know the URL.
Site setup
1. D1 migration
npx wrangler d1 execute YOUR-FORMS-DB --remote --file=node_modules/@logeix/phone-intent/migrations/phone-intent-events.sql2. config.json
"phone_intent": {
"enable": true,
"endpoint": "/api/track-phone-intent/",
"debug": "auto",
"watch_timeout_ms": 300000,
"thresholds": {
"bounce_max_ms": 8000,
"short_max_ms": 20000,
"medium_max_ms": 120000,
"long_max_ms": 300000
}
}3. Base.astro
{
config.phone_intent?.enable && (
<script>
import { initPhoneIntent } from '@logeix/phone-intent/client';
import siteConfig from '@/config/config.json';
initPhoneIntent(siteConfig.phone_intent);
</script>
)
}4. Pages Functions (thin re-exports)
functions/api/track-phone-intent.ts:
export { onRequestPost } from '@logeix/phone-intent/server/track-phone-intent';functions/api/close-stale-phone-intents.ts:
export {
onRequestPost,
onRequestGet,
} from '@logeix/phone-intent/server/close-stale-phone-intents';Requires D1 binding DB and SITE_NAME in wrangler.toml / Pages env (same as contact form).
Publish (maintainers)
- Bump
versioninpackage.json npm run build(updates committeddist/)- Commit, tag (
git tag v1.0.2), push tag - Update client sites to the new tarball URL (or publish to npmjs)
Debug
- Localhost /
?phoneIntentDebug=1/localStorage.phone_intent_debug = '1' - Optional
PHONE_INTENT_CRON_SECRETfor manual stale-close endpoint
