Documentation
Get started with Anested Analytics in minutes.
Quick Start (Script Tag)
Add this single line before </body>:
<script defer src="https://api.analytics.anested.com/a.js"
data-client-id="YOUR_CLIENT_ID"></script>That's it. Pageviews, sessions, clicks, scroll depth, SEO audit, and Web Vitals are all automatic.
NPM Installation
npm install @anested/analyticsReact / Next.js
import { init } from '@anested/analytics';
import { useEffect } from 'react';
export default function Layout({ children }) {
useEffect(() => {
init({ clientId: 'YOUR_CLIENT_ID' });
}, []);
return <>{children}</>;
}Vanilla JS
import { init, track } from '@anested/analytics';
init({ clientId: 'YOUR_CLIENT_ID' });
// Track custom events
track('signup_click', { plan: 'pro' });Configuration Options
| Option | Default | Description |
|---|---|---|
| clientId | required | Your site ID from the dashboard |
| host | api.analytics.anested.com | API endpoint |
| clicks | true | Track clicks, dead clicks, rage clicks |
| scroll | true | Track scroll depth |
| seo | true | Client-side SEO audit |
| performance | true | Web Vitals (LCP, FID, CLS) |
| location | false | Request browser geolocation |
| debug | false | Console logging |
Script Tag Attributes
| Attribute | Description |
|---|---|
| data-client-id | Your client/site ID |
| data-host | Custom API host |
| data-clicks="false" | Disable click tracking |
| data-scroll="false" | Disable scroll tracking |
| data-seo="false" | Disable SEO audit |
| data-performance="false" | Disable Web Vitals |
| data-location="true" | Request browser geolocation |
| data-debug="true" | Enable debug logging |
Custom Events
// Script tag
window.analytica.track('purchase', {
product: 'T-Shirt',
price: 29.99
});
// NPM
import { track } from '@anested/analytics';
track('purchase', { product: 'T-Shirt', price: 29.99 });What's Tracked Automatically
URL, path, title, referrer, UTM params
Duration, bounce detection, scroll depth
Browser, OS, screen size, device type
Country, region, city from IP
All clicks with element info, rage & dead clicks
Submit events with field count
Title, meta, headings, images, OG, structured data
LCP, FID, CLS
Lead Capture Form
Turn anonymous visitors into known leads. Enable a prebuilt, on-brand form from Dashboard → Lead Forms. It appears once per visitor and saves whatever you ask for (name, email, phone, or any custom field) to that visitor's profile.
- • Any fields you want — add name, phone, email, company or custom fields, each marked required or optional.
- • Remembers each device — a visitor is asked only once. If you later add a new field, only that new field is requested on their next visit.
- • Required or dismissable — make the whole form mandatory (blocking) or let visitors skip it.
- • Fully themeable — pick a theme (Dark, Light, Glass, Minimal, Gradient), layout (modal, bottom-sheet, card) and your own accent & border colors.
- • Captured details appear on the Visitors list (a Lead badge) and in full on each visitor's profile page.
a.js is installed, you turn it on and design it entirely from the dashboard — the script renders it for you.Step-by-step: collect name, email & phone
- Install the script once (see Quick Start above) — it powers analytics and the form.
- Open Dashboard → Lead Forms (under the Insights group).
- Toggle Enable on, and decide if it's Required (blocks the page) or dismissable (visitor can skip).
- Add your fields — use the Name, Email, and Phone presets, or add custom ones.
- Optionally set the theme, layout, colors, and labels. A live preview updates as you edit.
- Click Save. The form goes live immediately.
What each field has
| Property | Meaning |
|---|---|
| key | Internal id — e.g. name, email, phone, company, budget |
| label | What the visitor sees — e.g. “Your Name” |
| type | Input kind (see Field Types below) |
| placeholder | Greyed-out hint text inside the input |
| required | Whether the field must be filled |
| options | Only for the select type — the dropdown choices |
name,email, orphoneand it's recognised automatically — that value becomes the lead's display name, email, and phone across your dashboard. Any other key (e.g. company) is stored as a custom captured detail on the visitor.How it's shown
The tracking script fetches your form settings on load and renders it automatically — no extra code. Each device remembers what it has already answered, so a returning visitor is never asked twice. When a form is marked required, it blocks the page until the mandatory fields are filled; otherwise visitors can skip it. If you add a brand-new field later, only that new field is requested on the visitor's next visit.
Field Types
| Type | Use for |
|---|---|
| text | Names, companies, or any short free text |
| Email addresses (validated format) | |
| tel | Phone / mobile numbers |
| number | Numeric values (age, quantity, budget) |
| textarea | Longer messages or notes |
| select | A dropdown of predefined options |
Fields keyed name,email andphoneare recognised automatically and shown as the lead's display name, email, and phone across your dashboard.
Themes & Layout
- • Themes — Dark, Light, Glass, Minimal, Gradient.
- • Layouts — Modal (centered), Bottom-sheet, or Card.
- • Colors — set your own accent and border colors to match your brand.
- • Content — customise the title, description, submit label, and skip label.
Identify a visitor yourself
Nothing to install — the form is built into the tracking script. You can also set a visitor's display name from your own code:
// Set a display name for the current visitor
window.analytica.identify('Jane Doe');Where the data goes
- • Submissions are saved against the visitor's unique profile — new answers merge into any existing details.
- • A Lead badge appears on the Visitors list, with every captured field shown on the visitor's profile page.
- • Answers are stored on the visitor's device (no cookies) so the form is only shown when there's something new to ask.
Privacy
- • Respects
Do Not Trackand Global Privacy Control - • Opt-out:
window.__analytica_optout = true - • IP addresses are hashed server-side (never stored raw)
- • Browser geolocation is opt-in only
- • No cookies — localStorage for visitor ID, sessionStorage for session