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/analytics

React / 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

OptionDefaultDescription
clientIdrequiredYour site ID from the dashboard
hostapi.analytics.anested.comAPI endpoint
clickstrueTrack clicks, dead clicks, rage clicks
scrolltrueTrack scroll depth
seotrueClient-side SEO audit
performancetrueWeb Vitals (LCP, FID, CLS)
locationfalseRequest browser geolocation
debugfalseConsole logging

Script Tag Attributes

AttributeDescription
data-client-idYour client/site ID
data-hostCustom 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

Pageviews

URL, path, title, referrer, UTM params

Sessions

Duration, bounce detection, scroll depth

Devices

Browser, OS, screen size, device type

Location

Country, region, city from IP

Clicks

All clicks with element info, rage & dead clicks

Forms

Submit events with field count

SEO

Title, meta, headings, images, OG, structured data

Web Vitals

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.
No code required. The form is built into the tracking script. Once 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

  1. Install the script once (see Quick Start above) — it powers analytics and the form.
  2. Open Dashboard → Lead Forms (under the Insights group).
  3. Toggle Enable on, and decide if it's Required (blocks the page) or dismissable (visitor can skip).
  4. Add your fields — use the Name, Email, and Phone presets, or add custom ones.
  5. Optionally set the theme, layout, colors, and labels. A live preview updates as you edit.
  6. Click Save. The form goes live immediately.

What each field has

PropertyMeaning
keyInternal id — e.g. name, email, phone, company, budget
labelWhat the visitor sees — e.g. “Your Name”
typeInput kind (see Field Types below)
placeholderGreyed-out hint text inside the input
requiredWhether the field must be filled
optionsOnly for the select type — the dropdown choices
Tip — use the magic keys.Name a field's key exactly 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

TypeUse for
textNames, companies, or any short free text
emailEmail addresses (validated format)
telPhone / mobile numbers
numberNumeric values (age, quantity, budget)
textareaLonger messages or notes
selectA 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 Track and 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