All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Updated SmartCode 2.2 hide element re-insertion logic to prevent anti-flicker.
- Default
typetoSYNCwhen SmartCode version is3.0and notypeprop is passed
- Fixed SmartCode 3.0 localStorage config merge so stored
_vwo_*_configvalues correctly override component defaults
- Optimized performance with faster execution and reduced impact on Core Web Vitals (FCP & LCP) by offloading variation decisioning to VWO's servers.
- Introducing support for running tests directly through Cloudflare Workers, providing seamless and instant changes.(Coming soon)
- Added support for passing
attributesas props
<link
rel="preconnect"
href="URL"
{...linkAttributes}
/>-
First release of Next.js component for VWO Smart-code
Page Router (Legacy
pages/Directory)For applications using the Page Router, add the
VWOScriptcomponent inside_document.js(or_document.tsxif using TypeScript) to include it in the<head>of your HTML document.// pages/_document.js import Document, { Html, Head, Main, NextScript } from 'next/document'; import { VWOScript } from 'vwo-smartcode-nextjs'; class MyDocument extends Document { render() { return ( <Html> <Head> <VWOScript accountId="YOUR_ACCOUNT_ID" /> </Head> <body> <Main /> <NextScript /> </body> </Html> ); } } export default MyDocument;
App Router (
app/Directory)For applications using the App Router, include the
VWOScriptcomponent inlayout.tsxto ensure it loads correctly within the<head>of your HTML document.// app/layout.tsx import { VWOScript } from 'vwo-smartcode-nextjs'; export default function RootLayout({ children }: { children: React.ReactNode }) { return ( <html lang="en"> <head> <VWOScript accountId="YOUR_ACCOUNT_ID" /> </head> <body>{children}</body> </html> ); }
Using Nonce
To add a nonce attribute for Content Security Policy:
<VWOScript accountId="YOUR_ACCOUNT_ID" scriptAttributes={{ nonce: 'your-nonce-value', }} />