Deploying to Vercel
Vercel is the recommended platform for deploying Guigolo. Follow these steps for a smooth deployment.Prepare your repository
Ensure your code is pushed to a Git repository (GitHub, GitLab, or Bitbucket).
Import to Vercel
- Go to vercel.com and sign in
- Click “Add New Project”
- Import your Git repository
- Vercel will auto-detect Next.js settings
Configure environment variables
Add your analytics environment variables in the Vercel dashboard:
NEXT_PUBLIC_GA_ID- Your Google Analytics measurement IDNEXT_PUBLIC_HJ_ID- Your Hotjar site IDNEXT_PUBLIC_HJ_SV- Hotjar script version (default:6)
Environment Variables Setup
Guigolo uses environment variables for analytics services. These are loaded inapp/layout.tsx:81-86.
Required Variables
| Variable | Purpose | Where to Get It |
|---|---|---|
NEXT_PUBLIC_GA_ID | Google Analytics tracking | Google Analytics - Admin → Data Streams |
NEXT_PUBLIC_HJ_ID | Hotjar site identifier | Hotjar - Sites & Organizations |
NEXT_PUBLIC_HJ_SV | Hotjar script version | Usually 6 (optional, has default) |
Adding Variables in Vercel
Open project settings
In your Vercel dashboard, go to your project → Settings → Environment Variables
Add each variable
For each variable:
- Enter the variable name (e.g.,
NEXT_PUBLIC_GA_ID) - Enter the value
- Select environments: Production, Preview, Development
- Click “Save”
Variables prefixed with
NEXT_PUBLIC_ are exposed to the browser and can be used in client-side code. Never store secrets in these variables.Production-Only Loading
Analytics scripts only load in production to avoid tracking development traffic:app/layout.tsx
Domain Configuration
Adding a Custom Domain
Configure DNS
Vercel will provide DNS records to add at your domain registrar:For apex domain (example.com):For www subdomain:
Wait for verification
DNS propagation can take up to 48 hours, but usually completes within minutes to a few hours.
SSL Certificate
Vercel automatically provisions and renews SSL certificates for all domains. No action needed.Redirect Configuration
Guigolo includes extensive redirect rules innext.config.ts:4-197 for tracking traffic sources.
How Redirects Work
The configuration creates short URLs that redirect to your home page with UTM parameters:next.config.ts
yoursite.com/go/linkedin- LinkedIn profileyoursite.com/go/github- GitHub profileyoursite.com/go/figma- Figma profile- And many more…
Adding Custom Redirects
Add new redirects to the array innext.config.ts:
next.config.ts
Tracking Redirect Performance
All redirects include UTM parameters that are tracked by Google Analytics. You can see which platforms drive traffic in your Analytics dashboard under: Acquisition → Traffic Acquisition → Source / MediumBuild Optimization
Image Optimization
Next.js automatically optimizes images. For best results:- Use the
<Image>component fromnext/image - Provide
widthandheightprops - Use WebP or AVIF format when possible
- Store images in
/publicdirectory
Bundle Analysis
Analyze your bundle size before deploying:next.config.ts:
Performance Checklist
- ✅ Images are optimized and properly sized
- ✅ Fonts are preloaded and optimized
- ✅ Analytics scripts load with
afterInteractivestrategy - ✅ No console errors in production build
- ✅ Lighthouse score above 90 for performance
Continuous Deployment
Vercel automatically deploys your site when you push to your repository:- Production: Pushes to
mainbranch deploy to production - Preview: Pushes to other branches create preview deployments
- Comments: Preview URLs are commented on pull requests
Preview deployments include all environment variables marked for “Preview” environment, allowing you to test analytics and other features before going live.
Troubleshooting
Build Fails
- Check the Vercel build logs for errors
- Run
npm run buildlocally to reproduce - Ensure all dependencies are in
package.json - Verify Node.js version compatibility
Environment Variables Not Working
- Verify variable names start with
NEXT_PUBLIC_for client-side code - Check that variables are added to correct environment (Production/Preview)
- Redeploy after adding new variables
- Check browser console for the actual values loaded
Redirects Not Working
- Verify syntax in
next.config.ts - Clear browser cache
- Test in incognito/private mode
- Check Vercel function logs