UNPKG

proofly-js

Version:

A tiny JS tracking library for personal conversion tracking with a local dashboard

143 lines (95 loc) β€’ 3.5 kB
# Proofly JS **Self-hosted visitor & conversion tracker.** Track page views, clicks & scrolls on your website β€” keep your tracking data **private**, store it **locally**, and share your live visitor proof with anyone! --- ## ✨ What is this? **Proofly JS** lets you: - πŸ“Š Embed a simple tracker in **any website** (Next.js, Express.js, static HTML, etc.) - πŸ“‘ Send tracking data to your **own Relay server** - πŸ“ Store all visits in your **local folder** (`./proofly/visits.json`) - πŸ‘€ Run a local dashboard at `http://localhost:4000` to watch visitors in real-time No 3rd-party SaaS, no signups β€” **your site, your data**. --- ## πŸ“¦ 1️⃣ Install the library ```bash npm install proofly-js βš™οΈ 2️⃣ Add the tracker to your site ➜ Example: Next.js // pages/_app.tsx import { useEffect } from 'react'; import { initProofly } from 'proofly-js'; export default function App({ Component, pageProps }) { useEffect(() => { initProofly({ siteId: 'YOUR_SITE_ID', relayUrl: 'https://your-relay-server.onrender.com', }); }, []); return <Component {...pageProps} />; } ➜ Example: Express.js In your EJS or HTML template: html Copy Edit <script type="module"> import { initProofly } from '/node_modules/proofly-js/index.js'; initProofly({ siteId: 'YOUR_SITE_ID', relayUrl: 'https://your-relay-server.onrender.com', }); </script> ➜ Example: Plain HTML html Copy Edit <script type="module"> import { initProofly } from '/node_modules/proofly-js/index.js'; initProofly({ siteId: 'YOUR_SITE_ID', relayUrl: 'https://your-relay-server.onrender.com', }); </script> Run this command in your project root: βœ… Step 1 β€” Run the CLI npx proofly-init βœ… This will: Prompt you to enter your siteId (for example: my-portfolio) Auto-create a local-dashboard/ folder with a local Socket.IO + Express server Auto-create a proofly/ folder with visits.json to store your visitor data locally The siteId you enter here must match the siteId you use in your initProofly({ siteId, relayUrl }) snippet on your actual website β€” that’s how your local dashboard knows which site’s traffic to watch! --- βœ… Step 2 β€” Install & start dashboard cd local-dashboard npm install npm start Your dashboard will run at: http://localhost:4000 It connects to your Relay server and displays every visit in real-time. πŸ—‚οΈ 5️⃣ Where your data lives βœ… Visits are saved in ./proofly/visits.json βœ… The local dashboard reads & updates this file βœ… You keep everything β€” no cloud database needed ⚑ Full usage example import { initProofly } from 'proofly-js'; initProofly({ siteId: 'my-portfolio', relayUrl: 'https://my-relay.onrender.com', }); πŸ—‚οΈ Example project structure my-project/ β”œβ”€β”€ pages/_app.tsx β”œβ”€β”€ node_modules/ β”œβ”€β”€ local-dashboard/ # created by CLI β”œβ”€β”€ proofly/visits.json # auto created └── ... 🧩 Available CLI commands Command Description npx proofly-init Creates local-dashboard/ and proofly/visits.json automatically βœ… Ready to go 1️⃣ Embed the tracker 2️⃣ Deploy the Relay server 3️⃣ Run your local dashboard 4️⃣ Show your visitors, keep your data private. ❀️ License MIT β€” Self-host forever. No vendor lock-in. Built for indie devs, freelancers, and privacy lovers.