2.6 KiB
2.6 KiB
Marketing site
Landing pages, lead-capture forms, A/B-tested variants, region-routed homepages. Traffic is bursty (campaigns drive spikes). Bot traffic can be substantial.
Typical billing shape
Edge Requests dominate. Image Optimization is high (hero images, illustrations, product screenshots). Bandwidth matters for video content. Function Duration is usually low — most pages are static or ISR.
Priority patterns
- Aggressive caching at the edge. Marketing pages rarely change between campaign updates.
Cache-Control: public, s-maxage=86400, stale-while-revalidate=604800keeps the CDN warm for 24h and stale-serves for a week. - Bot Protection. Marketing campaigns attract competitor scrapers and bot traffic that inflates edge requests without delivering value. If edge cost is > $100/month and Bot Protection is disabled, this is almost always the top platform rec.
- ISR for content-driven sections. Customer logos, testimonials, "latest blog post" widgets, pricing tables — anything coming from a CMS. Revalidate hourly or on webhook.
- A/B test logic at the edge, not in the page. Edge Middleware for the variant assignment; cached static page per variant. Don't render the variant choice on every request.
- Defer all third-party JS post-hydration. Analytics, chat widgets, marketing pixels, cookie banners. None of them block the LCP. Cite
vercel-react-best-practices:bundle-defer-third-party.
Frequent gotchas
- Hero images served at native resolution. A 4MP hero image on every viewport, including mobile.
next/imagewithsizesis mandatory. - Cookie banner blocks first paint. GDPR-compliant cookie banners often render synchronously in the head. Defer; render after hydration; persist consent state via a tiny inline script.
- Tracking pixel waterfalls. Three different analytics services loaded in a chain. Load them after hydration in parallel; better yet, replace some with server-side tracking via webhook.
/api/contactis the only function but runs hot. Marketing sites are mostly static but the contact form gets bot-spammed. Rate limit at middleware; consider a queue for outgoing emails.
Cross-references
https://vercel.com/docs/bot-management— almost always the right platform rechttps://vercel.com/docs/incremental-static-regeneration— for CMS-driven sectionshttps://nextjs.org/docs/app/api-reference/components/image— hero/illustration optimizationvercel-react-best-practices:bundle-defer-third-party— defer analytics/pixelshttps://nextjs.org/docs/app/building-your-application/routing/middleware— A/B variant routing at the edge