This is an example showing how to emit events related to Uniform personalization and A/B testing only when component enters the viewport.
This is using IntersectionObserver API, emitting custom events personalization_seen and test_seen (see how these events are managed in PageComposition) and modified gtm plugin to send events in these conditions, see enableGtmAnalytics in uniformContext.ts.
npm installnpm run devand open localhost:3000
- Setup your own project id and API key values in
.envwith the API key that has Developer role. npm run uniform:pushto push content.npm run devand open localhost:3000
Both SSR (default) and SSG are supported, see /pages/[[...slug]].tsx.ssg and /pages/[[...slug]].tsx.ssr and enable the right mode for your use case.