Overview
Guigolo includes built-in support for three analytics services:- Google Analytics - Comprehensive traffic and user behavior tracking
- Hotjar - Session recordings and heatmaps
- Vercel Analytics - Real-time visitor and performance metrics
Google Analytics Setup
Google Analytics provides detailed insights into your portfolio traffic, user behavior, and acquisition channels.Create GA4 property
- Go to Google Analytics
- Click Admin (gear icon) → Create Property
- Enter your property name and configure settings
- Create a Web data stream
Get your Measurement ID
- In your data stream settings, find the Measurement ID
- It looks like
G-XXXXXXXXXX - Copy this ID
Add to environment variables
Add your Measurement ID to your environment variables:Local development (.env.local):Vercel:
- Go to Project Settings → Environment Variables
- Add
NEXT_PUBLIC_GA_IDwith your measurement ID - Select Production, Preview, and Development
- Save and redeploy
Implementation Details
Google Analytics is integrated inapp/layout.tsx:93-113:
app/layout.tsx
The
strategy="afterInteractive" ensures analytics scripts load after the page becomes interactive, optimizing performance.Hotjar Setup
Hotjar provides heatmaps, session recordings, and user feedback tools to understand how visitors interact with your portfolio.Create Hotjar account
- Sign up at Hotjar
- Create a new site
- Enter your domain name
Get your Site ID
- In Sites & Organizations, find your site
- Copy the Site ID (numeric value)
- Note the script version (usually
6)
Configure environment variables
Add both Hotjar variables:Local development (.env.local):Vercel:
- Add
NEXT_PUBLIC_HJ_IDwith your site ID - Add
NEXT_PUBLIC_HJ_SVwith value6(or current version) - Select all environments and save
Implementation Details
Hotjar is integrated inapp/layout.tsx:115-133:
app/layout.tsx
Vercel Analytics
Vercel Analytics provides real-time visitor metrics and Web Vitals tracking without cookies or configuration.Setup
Vercel Analytics is already integrated via the@vercel/analytics package in app/layout.tsx:4,135:
app/layout.tsx
Enable in Vercel dashboard
- Go to your project in Vercel
- Navigate to Analytics tab
- Click “Enable Analytics”
Features
- No configuration required - Works out of the box
- Real-time data - See visitors as they arrive
- Privacy-friendly - No cookies, GDPR compliant
- Web Vitals tracking - Monitor Core Web Vitals
- Unlimited events - No quota or sampling
Vercel Analytics is included free for all Vercel deployments. Unlike GA and Hotjar, it loads in all environments (production and preview).
Production-Only Loading
Analytics scripts are conditionally loaded based on the environment:app/layout.tsx
- Tracking your own development activity
- Inflating visitor counts during testing
- Running analytics scripts in preview deployments
Environment Detection
Vercel automatically sets theVERCEL_ENV variable:
| Environment | VERCEL_ENV Value | Analytics Load? |
|---|---|---|
| Production | production | ✅ Yes (GA, Hotjar) |
| Preview | preview | ❌ No (GA, Hotjar) |
| Development | development | ❌ No (GA, Hotjar) |
| All | Any | ✅ Yes (Vercel Analytics) |
Viewing Analytics Data
Google Analytics
Key reports to monitor: Realtime OverviewSee current visitors and what they’re viewing right now. Traffic Acquisition
Understand where visitors come from (your redirect links, organic search, direct, etc.). Pages and Screens
Identify which projects and pages get the most views. Events
Track user interactions if you add custom event tracking.
Hotjar
RecordingsWatch session replays to see how users navigate your portfolio. Heatmaps
Visual representation of where users click, move, and scroll. Feedback
Collect direct feedback from visitors (requires additional setup).
Hotjar has different pricing tiers based on daily sessions. The free tier includes 35 daily sessions, which may be sufficient for personal portfolios.
Vercel Analytics
Access in Vercel dashboard: VisitorsReal-time and historical visitor counts. Top Pages
Most visited pages on your site. Top Referrers
Sites sending traffic to your portfolio. Web Vitals
Performance metrics (LCP, FID, CLS, TTFB).
Best Practices
Test before deploying
Verify analytics load correctly by:
- Deploying to production
- Visiting your site in incognito mode
- Checking browser console for script loads
- Confirming data appears in each dashboard
Set up goals and conversions
In Google Analytics, create goals for:
- Project page views
- External link clicks (case studies, live sites)
- Time on page benchmarks
Monitor Web Vitals
Use Vercel Analytics to track Core Web Vitals and maintain good performance scores.
Troubleshooting
Analytics Not Loading
-
Check environment variables are set correctly
-
Verify you’re in production
Analytics only load when
VERCEL_ENV === "production". Preview deployments won’t load GA or Hotjar. -
Check browser console
Look for:
- Google Analytics gtag initialization
- Hotjar
hjobject in window - Any script loading errors
- Clear cache and test in incognito Browser extensions and cache can block analytics scripts.
Data Not Appearing in Dashboards
Google Analytics:- Wait 24-48 hours for data to populate historical reports
- Check Realtime report for immediate verification
- Verify the Measurement ID matches your property
- Check tracking status shows “Active” in dashboard
- Verify your domain matches the configured site
- Some browsers block Hotjar by default
- Enable Analytics in Vercel project settings
- Wait a few minutes for data to appear
- Refresh the Analytics dashboard