Skip to main content

Installation

Setup

1. Create the client instance

Create a shared client instance in a server-only module:

2. Add identity middleware

Create middleware.ts at the root of your project:
This ensures every visitor has an rlvt_tmpId cookie before any personalised content is requested.

Request flow

The ReelevantZone is an async React Server Component that fetches and renders personalised content:

ZoneProps

Custom rendering with JSON

For headless personalisation where you want to build your own UI:

Manual usage (without ReelevantZone)

If you prefer direct control:

Multiple zones on a page

Fetch multiple zones in parallel for optimal performance:
Each ReelevantZone is an independent async component that fetches in parallel when rendered at the same level. You don’t need to use runAll explicitly with components — Next.js handles the parallel fetching automatically.

Click tracking

Click tracking must always be set up after display. Every content display should have a corresponding click tracking mechanism — either a redirect link or a trackClick() call.
Every RunResult includes redirectionUrl and trackClick(). Two patterns: Use redirectionUrl directly as an <a href>:

Server-side fire-and-forget

Call result.trackClick() from a Server Action — it records the click and swallows all errors:
See Core SDK — Click tracking for full details.

Compatibility with the client tracker

The SDK adds data-rlvt-ssr="true" to rendered elements. The client-side Reelevant tracker automatically skips zones with this attribute, so there is no double-loading or flickering. You can still use the client tracker on the same page for:
  • Event tracking (clicks, impressions, conversions)
  • Client-only zones (consent-dependent content, overlays)
  • On-site integrations (datalayer triggers, URL rules)