Installation
Get PennyLens running on your site in two minutes.
Option 1: Script Tag (recommended for most sites)
Paste this snippet into the <head> of your site. Replace YOUR_API_KEY with the key from Settings → API key — the dashboard shows the finished snippet there, ready to copy.
The attribute is named data-project for historical reasons, but the value it takes is your API key, not the project id. Pasting the project id is accepted by the browser and then silently rejected at ingest, so you would see no events and no error.
<script
src="https://cdn.pennylens.com/tracker.js"
data-project="YOUR_API_KEY"
async
></script>
That's it. PennyLens starts tracking pageviews, clicks, scroll, and form interactions automatically.
Option 2: npm (for SPAs and custom setups)
npm install @pennylens/tracker
Initialize the tracker in your app entry point:
import { PennyLens } from "@pennylens/tracker";
PennyLens.init({
projectId: "YOUR_API_KEY", // your API key, despite the option name
// Optional: sessionRecording, consentRequired, debug, etc. — see the SDK reference.
});
Verify
- Open your site in a browser.
- Go to the PennyLens dashboard.
- Navigate to Overview — you should see a live pageview appear within 10 seconds.
If you don't see events after 30 seconds, check your browser console for errors and confirm the data-project value is your API key from Settings → API key. A project id in that slot is the most common cause of a silent no-op: the request is rejected at ingest and nothing appears in the dashboard.
Next steps
- Event Tracking — custom events, user identification, privacy controls
- API Reference — complete data model reference