Achieving Perfect Google Lighthouse Scores on HubSpot
Google Lighthouse is the industry-standard tool for measuring website quality. Achieving high Lighthouse scores on your HubSpot CMS site improves user experience, SEO rankings, and conversion rates.
Understanding Lighthouse Metrics
Lighthouse audits five key areas:
1. Performance (0-100)
Measures loading speed and runtime performance:
2. Accessibility (0-100)
Evaluates how accessible your site is to all users:
3. Best Practices (0-100)
Checks for modern web development standards:
4. SEO (0-100)
Assesses search engine optimization:
5. Progressive Web App (0-100)
Evaluates PWA capabilities (optional for most sites)
Performance Optimization
Image Optimization
Images are often the biggest performance bottleneck:
1. Compress Imagesbash
Use tools like:
2. Use Modern Formats
html
4. Serve Responsive Images
html
sizes="(max-width: 600px) 480px, (max-width: 1000px) 800px, 1200px"
src="large.jpg"
alt="Description"
/>
5. Set Proper Dimensions
Always specify width and height to prevent layout shift:
html
JavaScript Optimization
1. Minimize JavaScripthtml
3. Avoid Render-Blocking Scripts
CSS Optimization
1. Minimize CSSInline critical above-the-fold CSS:
html
3. Avoid CSS @import
Use link tags instead:
html
Font Optimization
1. Use System FontsFastest option - no download required:
css
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
2. Optimize Web Fonts
html
rel="preconnect"
href="https://fonts.googleapis.com"
/>
rel="preconnect"href="https://fonts.gstatic.com"
crossorigin
/>
3. Font-Display Strategy
css
@font-face {
font-family: 'MyFont';
src: url('myfont.woff2') format('woff2');
font-display: swap; /* Show fallback immediately */
}
Core Web Vitals Optimization
Largest Contentful Paint (LCP) - Target: < 2.5sAccessibility Optimization
Color Contrast
Ensure sufficient contrast ratios:
css
/* Good contrast */
.text {
color: #333333;
background: #ffffff;
}
/* Poor contrast - avoid */
.text-bad {
color: #cccccc;
background: #ffffff;
}
Alt Text for Images
Always provide descriptive alt text:
html
Form Accessibility
1. Label All Inputshtml
2. Add ARIA Labels When Needed
html
3. Provide Error Messages
html
type="email"
aria-invalid="true"
aria-describedby="email-error"
/>
Please enter a valid email
Keyboard Navigation
Ensure all interactive elements are keyboard accessible:
css
/* Visible focus indicators */
button:focus,
a:focus {
outline: 2px solid #0066cc;
outline-offset: 2px;
}
/* Don't remove outlines without replacement */
*:focus {
outline: none; /* BAD - never do this */
}
Semantic HTML
Use proper HTML5 semantic elements:
html
Title
Best Practices Optimization
HTTPS Everywhere
HubSpot provides automatic SSL, ensure:
Eliminate Console Errors
Check browser console for:
Proper Image Aspect Ratios
Prevent stretching or squishing:
css
.image-container {
aspect-ratio: 16 / 9;
}
.image-container img {
width: 100%;
height: 100%;
object-fit: cover;
}
Avoid Document.write()
Never use document.write() - it's blocking:
javascript
// Bad
document.write('');
// Good
const script = document.createElement('script');
script.src = 'ad.js';
document.body.appendChild(script);
SEO Optimization
Meta Description
Every page should have a unique meta description:
html
Mobile-Friendly
Ensure mobile viewport is set:
html
Crawlability
Check robots.txt and meta robots:
html
Structured Data
Add Schema.org markup:
json
{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "ThemesMake",
"url": "https://themesmake.com",
"description": "HubSpot CMS expertise and themes"
}
HubSpot-Specific Optimizations
Module Optimization
1. Use Lazy Loading for ModulesEnable lazy loading for below-the-fold modules in HubSpot
2. Optimize Module CSSKeep module styles minimal and scoped
3. Conditional LoadingLoad resources only when modules are present
Template Optimization
1. Minimize Template ComplexityTheme Optimization
Choose optimized themes like Realize that are built with performance in mind:
Testing and Monitoring
Run Lighthouse Audits
1. Chrome DevToolsTest from Google's servers: https://pagespeed.web.dev/
3. Lighthouse CIAutomated testing in your deployment pipeline
Test on Real Devices
Lighthouse simulates conditions, but also test:
Continuous Monitoring
Set up monitoring:
Common Issues and Solutions
Issue: Low Performance Score
Causes:Issue: Poor Accessibility Score
Causes:Issue: SEO Issues
Causes:Real-World Example: Optimizing a HubSpot Page
Let's optimize a typical HubSpot landing page:
Before
Optimizations Applied
After
Conclusion
Achieving perfect Lighthouse scores requires attention to detail and ongoing optimization. Focus on:
With HubSpot CMS and proper optimization techniques, 90+ scores across all categories are achievable. The Realize theme provides an excellent foundation for high-performing websites.
Start with quick wins (image optimization, alt text), then tackle more complex optimizations. Your users, search engines, and conversion rates will thank you.