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

HTML

Website builders & CMS

WordPressWooCommerceShopifyWebflowFramerWixSquarespaceGhostHubSpot CMSBigCommerceCarrdBubbleKajabiDiscourseDrupalJoomla

Frameworks

Next.jsReact (Vite / CRA)Remix / React RouterGatsbyVueNuxtSvelteKitAstroAngularLaravelDjangoRuby on RailsFlask / FastAPIPhoenix

Static sites & docs

HugoJekyllEleventy (11ty)DocusaurusVitePressMkDocs (Material)

Tools & AI builders

Google Tag ManagerLovable, Bolt & v0

Avoid ad blockers

Serve PageLens from your own domain: proxy guide for Next.js, Cloudflare, Vercel, Netlify, Nginx and Caddy.

Script options

AttributeWhat it does
data-site-idRequired. Your site's id.
data-skip-patternsJSON list of paths not to track, e.g. '["/admin/**", "/preview/*"]'. * matches one path segment, ** anything, re: starts a regular expression.
data-mask-patternsJSON list of paths to record under the pattern itself, e.g. '["/users/*/settings"]' keeps ids out of your reports.
data-tagA label sent with every event from this page (A/B variant, release). Filter by Tag in the dashboard.
data-apiSend data somewhere other than next to the script (rarely needed; proxies work without it).
data-allow-localhostAlso 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