← Protocols
Cookie3
Analytics·EVM · Solana · Multi-chain

Cookie3

01Description

Web3 analytics and attribution suite often described as 'Google Analytics for Web3'. Tracks page views, on-chain wallet events (connect, sign, transact), and marketing campaigns with a single JS snippet, surfacing dashboards and AI-driven insights at app.cookie3.co.

02Best for
  • 01drop-in Web3 site analytics
  • 02wallet-aware funnel + conversion tracking
  • 03campaign attribution by UTM and referrer
  • 04GA-style dashboards with on-chain enrichment
  • 05audience segmentation by wallet behavior
03Install
  • pnpm add @cookie3/analytics
04Environment variables
VariableScopeDescription
NEXT_PUBLIC_COOKIE3_SITE_IDClientCookie3 site ID copied from app.cookie3.co → /data-sources → Integrate Website. Client-safe — it only identifies the site, not the user.
05Prompt snippet
Install the `@cookie3/analytics` plugin (built on the `analytics` library) and initialize once on the client with your site ID: `import Analytics from 'analytics'; import cookie3Plugin from '@cookie3/analytics'; const analytics = Analytics({ app: 'my-dapp', plugins: [cookie3Plugin({ siteId: process.env.NEXT_PUBLIC_COOKIE3_SITE_ID!, trackerUrl: 'https://webanalytics.cookie3.co' })] })`. Call `analytics.page()` on every route change (Next.js: hook into `usePathname`) — Cookie3 does NOT auto-track in SPAs. For wallet-aware events: `analytics.track('wallet_connected', { address, chainId })` and similar for swaps/mints. Whitelist `webanalytics.cookie3.co` in your CSP `connect-src` directive or the plugin will silently fail.
06Gotchas
  • GDPR / cookie consent: Cookie3 — despite the name — sets identifiers; gate `Analytics()` initialization behind your consent banner for EU/UK users or you'll be non-compliant.
  • Single Page Apps require manual `analytics.page()` calls on every route change — it does NOT hook into Next.js / React Router automatically; without it you'll under-count pageviews by 5–10x.
  • Content Security Policy: you must whitelist `https://webanalytics.cookie3.co` in `connect-src` (and `script-src` if using the CDN snippet) or events will be dropped silently.
  • PII: never include email, full name, or IP in event properties — Cookie3 is designed for wallet+behavior data and stuffing PII in custom props can void the data-processing agreement.
  • Wallet attribution requires you to call a `connectWallet`/`identify` event yourself with the address — until you do, Cookie3 only sees an anonymous browser fingerprint.
  • Two doc domains exist (docs.cookie3.co and docs.cookie3.com) and they sometimes drift — when in doubt, the `.com` host is the canonical product docs and `.co` hosts integration recipes.
07Alternatives