Skip to content

This repository provides examples of integrating NextJS with the Kameleoon Application File engine.js.

Notifications You must be signed in to change notification settings

Kameleoon/setup-engine-nextjs

Repository files navigation

Kameleoon + Next.js (App Router) Integration Guide

This project includes a production-ready integration of Kameleoon engine with Next.js App Router, optimized for no flicker, lazy engine loading, and SSR compatibility.


Features

  • Anti-flicker protection on SSR
  • Hydration-aware script execution
  • Asynchronous engine loading
  • Fallback timeout for reliability
  • No blocking scripts
  • Works with Next.js layouts, streaming, and React Server Components

File Structure

├─ app/
│ ├─ layout.tsx # Root layout (App Router)
│ └─ page.tsx # Main page
│
└─ integrations/
└─ Kameleoon/
├─ KameleoonHead.tsx # SSR anti-flicker + preload
├─ KameleoonHydrationReady.tsx # Client script loader (after hydration)
└─ sitecode.ts # Kameleoon engine URL config

Setup

1️⃣ Copy integration folder

integrations/Kameleoon/

2️⃣ Configure site code

Open: integrations/Kameleoon/sitecode.ts

Replace SITECODE with your actual site code:

Usage

Add integration to app/layout.tsx

export default function RootLayout({ children }) {
    return (
        <html lang="en">
            <head>
                <KameleoonHead />
            </head>
            <body className={inter.className}>
                <KameleoonHydrationReady />
                {children}
            </body>
        </html>
    );
}

About

This repository provides examples of integrating NextJS with the Kameleoon Application File engine.js.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published