CapraLensDashboard →

Documentation

Get started with CapraLens in under 2 minutes.

Quick Start

Add this script tag before the closing body tag on any page:

<script
  src="https://capralens.com/capralens.js"
  data-property="your-site-slug"
  defer
/>

Replace your-site-slug with a lowercase slug (letters, numbers, hyphens). Data will appear in your dashboard within seconds.

Next.js Integration

// app/layout.tsx
import Script from "next/script";

export default function Layout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Script
          src="https://capralens.com/capralens.js"
          data-property="your-site"
          data-endpoint="https://capralens.com/api/capralens/collect"
          strategy="afterInteractive"
        />
      </body>
    </html>
  );
}

SPA Support

The embed script automatically patches history.pushState and listens for popstate events. Client-side navigations (Next.js, React Router, etc.) are tracked automatically.

UTM Campaign Tracking

CapraLens automatically captures UTM parameters from the URL:

https://yoursite.com/landing?utm_source=twitter&utm_medium=social&utm_campaign=launch

The dashboard shows breakdowns by campaign, source, and medium.

Custom Events

Send custom events via the collection API:

fetch("https://capralens.com/api/capralens/collect", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    property: "your-site",
    event_type: "custom",
    page: "/signup-complete",
  }),
});

Goals & Conversions

Define URL-based goals in the dashboard. A goal fires when a pageview matches the URL pattern (exact, starts with, contains, or regex). Track conversion rates across pages and campaigns.

Analytics API

Pull analytics data programmatically:

GET https://capralens.com/api/v1/analytics
  ?property=your-site
  &range=14
  &fields=summary

Headers:
  Authorization: Bearer YOUR_API_KEY

Two kinds of credential are accepted:

  • cl_…Per-property keys (cl_…) — generate one per site under My Sites. A per-property key can read only its own property; requesting any other property returns 401. The plaintext is shown once at generation — copy it then; only a hash is stored.
  • CAPRALENS_API_SECRETMaster secret (CAPRALENS_API_SECRET) — an admin-any override that can read every property. Keep it server-side only.

Response (fields=summary):

{
  "property": "your-site",
  "range": 14,
  "pageviews": 1234,
  "visitors": 456,
  "bounceRate": 42,
  "pagesPerSession": 3.2,
  "timeseries": [
    { "date": "2026-06-14", "count": 89 },
    ...
  ]
}

Without fields=summary, the full response includes top pages, referrers, countries, devices, browsers, OS, languages, UTM breakdowns, and Core Web Vitals.

Core Web Vitals

CapraLens measures LCP, CLS, and INP in the field using PerformanceObserver. Values are aggregated using the 75th percentile (P75), matching Google's methodology. Outliers do not skew the results.

Public Dashboards

Enable public sharing on any site in your dashboard. You will get a shareable URL like capralens.com/share/abc123 that anyone can view without logging in.

Privacy

CapraLens does not use cookies, localStorage, or fingerprinting. Visitor identity is computed as a SHA-256 hash of the IP plus property plus date plus a server-side salt. The hash resets daily and differs across properties. Raw IPs are never stored.