React hooks and TypeScript library for growth instrumentation. Currently focused on referral URL tracking, but may expand in the future.
This is 100% open source with MIT license, enjoy!
npm install @fullstackcraftllc/growthkituseReferralUrl(options: UseReferralUrlOptions): UseReferralUrlResultexportinterfaceUseReferralUrlOptions{productName: string;enabled?: boolean;onEvent?: (event: ReferralEvent)=>void|Promise<void>;metadata?: Record<string,JsonValue>;}import{useReferralUrl}from'@fullstackcraftllc/growthkit';functionMarketingLayout(){useReferralUrl({productName: 'vannacharm.com',onEvent: async(event)=>{console.log('track event',event);},metadata: {experiment: 'hero-copy-v2',variant: 'B',},});returnnull;}import{useReferralUrl}from'@fullstackcraftllc/growthkit';import{supabase}from'./supabaseClient';functionMarketingLayout(){useReferralUrl({productName: 'vannacharm.com',onEvent: async(event)=>{const{ error }=awaitsupabase.from('growthkit_referral_events').insert(event);if(error)throwerror;},});returnnull;}Use sql/growthkit_referral_events.sql.
- Landing-only attribution: one event per browser tab session and
productName. - Dedupe is intentionally backed by
sessionStorage. - If
enabledisfalse, tracking is skipped.
npm ci
npm run type-check
npm test
npm run build
npm run verify:dist-versionMIT