proofly-js
Version:
A tiny JS tracking library for personal conversion tracking with a local dashboard
143 lines (95 loc) β’ 3.5 kB
Markdown
# 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.