Install guides
PageLens works on any site that can load a script tag. Pick your platform for exact steps. Replace YOUR_SITE_ID with the id shown in your PageLens site settings.
Any website
Website builders & CMS
WordPressWooCommerceShopifyWebflowFramerWixSquarespaceGhostHubSpot CMSBigCommerceCarrdBubbleKajabiDiscourseDrupalJoomla
Frameworks
Next.jsReact (Vite / CRA)Remix / React RouterGatsbyVueNuxtSvelteKitAstroAngularLaravelDjangoRuby on RailsFlask / FastAPIPhoenix
Static sites & docs
Tools & AI builders
Avoid ad blockers
Serve PageLens from your own domain: proxy guide for Next.js, Cloudflare, Vercel, Netlify, Nginx and Caddy.
Script options
| Attribute | What it does |
|---|---|
data-site-id | Required. Your site's id. |
data-skip-patterns | JSON list of paths not to track, e.g. '["/admin/**", "/preview/*"]'. * matches one path segment, ** anything, re: starts a regular expression. |
data-mask-patterns | JSON list of paths to record under the pattern itself, e.g. '["/users/*/settings"]' keeps ids out of your reports. |
data-tag | A label sent with every event from this page (A/B variant, release). Filter by Tag in the dashboard. |
data-api | Send data somewhere other than next to the script (rarely needed; proxies work without it). |
data-allow-localhost | Also track on localhost (off by default). |
JavaScript API
pagelens.track('signup', { plan: 'pro' }) // custom event
pagelens.identify('user_123', { email, plan }) // link this visit to your user
pagelens.setTraits({ plan: 'business' }) // update the identified user's traits
pagelens.getUserId() // id passed to identify() on this page, or null
pagelens.reset() // on sign-out
HTML attributes: data-pagelens-event="name" and data-pagelens-prop-* on any element or form; data-pagelens-ignore keeps an element out of autocapture.
Don't have a site ID yet?
Create a free PageLens account: 7-day trial, no card, no cookie banner needed.
Start free trial