Start a Vercel project with analytics already wired in.
A small Next.js template with visitor analytics, speed tracking, conversion events and campaign links set up the right way. Deploy it in one click, then build on top.
✓ Next.js App Router✓ TypeScript✓ MIT licence✓ Works without Lookout
What's already set up
Visitor analyticsVercel Web Analytics, mounted once in the root layout so every page is counted.
app/layout.tsxSpeed trackingVercel Speed Insights next to it, so real-visitor speed is measured from the first deploy.
app/layout.tsxConversion eventsVercel Analytics custom events (track()) for signup, purchase and form submit, sent only when the action succeeds. Needs Vercel Pro.
lib/track.tsCampaign linksOne helper that tags links you share outside your site the same way every time, so campaigns show up by name.
lib/campaign.tsimport { Analytics } from "@vercel/analytics/next";
import { SpeedInsights } from "@vercel/speed-insights/next";
import type { Metadata } from "next";
import type { ReactNode } from "react";
import "./globals.css";
export const metadata: Metadata = {
title: "Lookout Starter",
description: "A Next.js starter with Vercel Web Analytics and Speed Insights already set up.",
};
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Analytics />
<SpeedInsights />
</body>
</html>
);
}import { track } from "@vercel/analytics";
export type Conversion = "signup" | "purchase" | "form_submit";
export interface TrackedElement {
id?: string;
dataset?: { track?: string; trackLabel?: string };
}
export function conversionProps(el?: TrackedElement | null): Record<string, string> {
const props: Record<string, string> = {};
const name = el?.dataset?.track || (el?.id ? `#${el.id}` : "");
const label = el?.dataset?.trackLabel ?? "";
if (name) props.el = name.slice(0, 255);
if (label) props.label = label.slice(0, 255);
return props;
}
export function trackConversion(name: Conversion, el?: TrackedElement | null): void {
track(name, conversionProps(el));
}
export async function trackOnSuccess<T>(name: Conversion, action: () => Promise<T>, el?: TrackedElement | null): Promise<T> {
const result = await action();
if (typeof Response !== "undefined" && result instanceof Response && !result.ok) return result;
trackConversion(name, el);
return result;
}export interface Campaign {
source: string;
medium: string;
campaign: string;
}
export const utmValue = (v: string) => v.trim().toLowerCase().replace(/\s+/g, "_");
export function campaignUrl(url: string, c: Campaign): string {
let u: URL;
try {
u = new URL(url);
} catch {
throw new Error(`campaignUrl needs a full address such as https://yoursite.com/page, not "${url}". It is for links you share outside your site.`);
}
if (u.protocol !== "https:" && u.protocol !== "http:") throw new Error(`campaignUrl needs an http(s) address, not "${url}".`);
for (const [key, value] of [["utm_source", c.source], ["utm_medium", c.medium], ["utm_campaign", c.campaign]] as const) {
const clean = utmValue(value);
if (!clean) throw new Error(`campaignUrl: ${key} is empty.`);
u.searchParams.set(key, clean);
}
return u.toString();
}Both components are mounted once, in the root layout, so every page is counted. In local development they send nothing.
Live in about five minutes
01DeployOne click. Vercel copies the starter into your GitHub account and deploys it.
02Turn on two switchesIn the Vercel dashboard, click Enable on the Analytics tab and on the Speed Insights tab.
03Connect LookoutOptional. Paste a read-only token and the new project appears on your board with the others.
Already have a project?Copy one task for your AI coding agent. It adds the same four pieces to an existing repository and tells you which files it changed.
Then see every project on one board.The starter works with Vercel's own dashboard. Lookout adds one view across all your projects, a grade per page and an email when a site drops.