DashForDevsDocs
DocsNewsAPI v1
dashfordevs.comSign in

© 2026 DashForDevs

DocsNewsdashfordevs.comLegalStatus
DocsSite Keys & Client SitesThe insights beacon
Introduction
Getting Started
Authentication
Products
Categories
Cart
Checkout
Blog
Reviews
Webhooks
Customers
Orders
Inventory
Shipping
Discounts
Affiliates
Email
Media & Files
Analytics & Tracking
Locations
Tax
Global Data
SEO
Error Handling
Geography
Finance
Automations
Page Types
Surveys
Billing & Subscriptions
Storefront Payments
SDK Reference
REST API
Storefront Architecture
Notifications
Security
Team & Permissions
Migrations & Import
Calendar & Appointments
Contact Forms
AI Bots
Dashboard API
Deployment
Changelog
Troubleshooting
Recipes
CLI & Deployment
Image Pipeline
White-label Platforms
Records Engine
Platform Modules
Platform Security
Site Keys & Client Sites
OverviewSite keysThe /api/site surfaceThe insights beaconCDN buildsThe powered-by badgeBuilding a paired site SDK
Use Cases
Operations

The insights beacon

Mount once, track everything, never break the site.

Updated July 26, 2026

On this page
  • Mounting
  • What it captures
  • Delivery discipline

Mounting

The tracker mounts once in the site's root layout, browser-side, with the public key:

typescript
"use client";
import { useEffect } from "react";
import { usePathname } from "next/navigation";
import { lps } from "@/lib/lps";

export default function AnalyticsTracker() {
  const pathname = usePathname();
  useEffect(() => {
    lps.insights.init({ autoPageviews: false, autoClicks: true });
  }, []);
  useEffect(() => {
    lps.insights.notifyRouteChange();   // SPA navigations become pageviews
  }, [pathname]);
  return null;
}

What it captures

  • Pageviews — driven by route-change notifications in SPA frameworks (auto-pageviews exist for non-SPA pages).
  • Clicks — links, buttons and [data-track] elements automatically; opt any subtree out with data-no-track.
  • Custom events and conversions — lps.insights.track("menu_view", { category: "flower" }), lps.insights.conversion(0, { name: "lead" }).
  • Attribution — a persistent visitor id (localStorage) carries first-touch and last-touch UTM parameters across the whole journey: a visitor who lands on ?utm_source=google still attributes to google three pages later.

Delivery discipline

  • Events are batched and flushed via sendBeacon/keepalive, so navigation and tab-close don't lose the tail.
  • Every failure is silent. Analytics can never break the site — a down collector costs data, never a render.
  • The collector endpoint (POST /api/site/insights) accepts the public key from allowed origins only, like every other public read.

The platform dashboard reads the results per site: totals, bucketed timeseries, top pages, referrers, and UTM source/medium/campaign breakdowns.

PreviousThe /api/site surfaceNextCDN builds

On this page

  • Mounting
  • What it captures
  • Delivery discipline