A Dev's Guide to SEO & Performance π
Is your website just vibing, or is it truly performing? It's easy to launch a site and move on, but to rank on Google and keep users engaged, your digital house needs to be in top shape. Forget guessworkβthis guide shows you how to build a Website Auditor to score your site's SEO and performance with cold, hard numbers.
We'll cover essential checks, a weighted scoring system, and PHP code snippets to kickstart your project. Let's dive in!
The Vibe Check: What We're Auditing π§
Our auditor evaluates six critical areasβthink of them as your website's report card.
1. Basic Document Setup
The Gist: Ensures the bare essentials for a modern webpage are in place.
Why It Matters: Missing doctype
, charset
, or viewport
can confuse browsers and search engines, breaking your site's foundation.
2. On-Page SEO
The Gist: Assesses elements search engines use to understand your content.
Why It Matters: Titles, descriptions, and headers determine if you rank on page one or vanish into obscurity.
3. Content Quality & Markup
The Gist: Evaluates content depth and HTML cleanliness.
Why It Matters: Search engines favor well-structured, high-quality content. Clean markup boosts crawlability and user experience.
4. Media & Image Optimization
The Gist: Checks image formats, alt text, and loading performance.
Why It Matters: Unoptimized images slow your site, tanking Core Web Vitals and accessibility.
5. Technical & Performance Factors
The Gist: Inspects server configuration, speed, and security.
Why It Matters: Slow response times or security flaws hurt rankings, user experience, and conversions.
6. Links
The Gist: Examines internal and external link structure.
Why It Matters: Poor link quality or broken links can damage SEO and user trust.
Scoring Like a Pro: The Weighted System π
We use a weighted scoring system (0β100%) to pinpoint where your site needs work.
Issue Weights: The Penalty Box
Issues are weighted based on severity, like levels in a video game:
- π΄ Major (60%): Critical issues tanking performance or SEO.
- π Moderate (30%): Important fixes that improve your site.
- π‘ Minor (10%): Small tweaks for polish.
- π’ Passed (0%): No penaltyβnice job!
- π΅ Info (0%): Just FYI, no judgment.
- βͺοΈ Unknown (0%): Scanner couldn't determine, no penalty.
The Math
- Count total tests.
- Calculate penalty points (
count Γ weight
) for each issue. - Sum all penalty points.
- Divide by total tests to get average penalty percentage.
- Subtract from 100% for the final score.
Example:
For 50 tests:
- 5 Major issues:
5 Γ 60% = 300
points - 3 Moderate issues:
3 Γ 30% = 90
points - 2 Minor issues:
2 Γ 10% = 20
points - Total Penalty:
300 + 90 + 20 = 410
points - Average Penalty:
410 Γ· 50 = 8.2%
- Final Score:
100% - 8.2% = **91.8%**
Report Card
- 90β100% (A): Crushing it!
- 80β89% (B): Solid, but tweakable.
- 70β79% (C): Needs work.
- 60β69% (D): Serious issues detected.
- Below 60% (F): Red alertβfix now!
The Deep Dive: Every Check Explained
Hereβs what we check in each category.
1. Basic Document Setup
- Doctype Declaration: Is
<!DOCTYPE html>
present? (Major if missing) - Language Attribute: Does
<html>
have a validlang
attribute? (Major if missing) - Meta Charset: Is
<meta charset="UTF-8">
included? (Major if missing) - Meta Viewport: Is the viewport tag set for mobile responsiveness? (Major if missing)
- Favicon: Is a favicon linked for browser tab branding? (Minor if missing)
2. On-Page SEO
- Title Tag: Present, with optimal length (30β60 chars)? (Major if missing, Minor if length is off)
- Meta Description: Present, with optimal length (50β160 chars)? (Minor if missing or length is off)
- H1 Tag: Exactly one H1 tag? (Major if missing, Moderate if multiple)
- Meta Robots: Is
noindex
accidentally blocking Google? (Major if found) - Canonical URL: Is
rel="canonical"
used to avoid duplicate content? (Minor if missing) - SEO-Friendly URL: Clean URL (e.g.,
/about-us
) vs. messy parameters (e.g.,/page?id=123
)? (Minor if non-friendly) - Open Graph Tags: Are tags present for social sharing? (Minor if none)
3. Content Quality & Markup
- Word Count: Enough content? (Moderate if < 300 words)
- Deprecated HTML Tags: Using outdated tags like
<font>
or<center>
? (Minor) - Inline CSS: Are
style="..."
attributes cluttering HTML? (Minor) - Plaintext Emails: Are email addresses exposed to spam bots? (Moderate)
- Text-to-HTML Ratio: Mostly content or code-heavy? (Major if < 15%)
4. Media & Image Optimization
- Image Formats: Using modern formats like WebP or AVIF? (Moderate if not)
- Image Alt Attributes: Do all
<img>
tags have descriptive alt text? (Major if missing) - Lazy Loading Images: Are off-screen images using
loading="lazy"
? (Moderate if not)
5. Technical & Performance Factors
- robots.txt: Is a valid
robots.txt
file present? (Minor if missing) - 404 Page: Does the server return a proper 404 status for nonexistent pages? (Major if it returns 200)
- Server Compression: Is Gzip or Brotli enabled? (Minor if not)
- Response Time: Is Time to First Byte (TTFB) fast? (Moderate if > 2s)
- Page Size: Total download size? (Major if > 150KB)
- DOM Size: Number of DOM elements? (Minor if excessive)
- Secure URL (HTTPS): Is the site served over HTTPS? (Major if not)
- Valid SSL Certificate: Is the SSL certificate valid? (Major if expired)
6. Links
- Unsafe External Links: Are
rel="noopener noreferrer"
used for new-tab links? (Moderate if not) - Internal & External Links: Counted for informational purposes.
Auditor Code Overview π»
Basically, the auditor works on Laravel Services. The point of this article isn't to explain Services or go into them to depth, just know that all of these files are a service, and a service is kinda like a helper, but a little more 'robust', they are like, fat helpers.
Basically we have the main ComprehensiveAuditService
that can easily called from the controller or wherever, simply pass it the URL and then the service takes care of all the heavy lifting.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ποΈ AUDIT SERVICES ARCHITECTURE ποΈ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π COMPREHENSIVE AUDIT SERVICE β
β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β ComprehensiveAuditService.php β β
β β π― MAIN ORCHESTRATOR - Coordinates all audit services β β
β β β’ Fetches webpage content via HTTP client β β
β β β’ Caches results for performance β β
β β β’ Aggregates results from all specialized services β β
β β β’ Returns comprehensive audit report β β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π§ SPECIALIZED AUDIT SERVICES β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π BasicDocumentService.php β
β π― DOCUMENT STRUCTURE VALIDATOR β
β β’ Checks DOCTYPE declaration β
β β’ Validates language attribute on <html> β
β β’ Verifies meta charset encoding β
β β’ Ensures viewport meta tag for mobile β
β β’ Confirms favicon presence β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π SeoAnalysisService.php β
β π― SEO OPTIMIZATION ANALYZER β
β β’ Validates page title (length, presence) β
β β’ Checks meta description quality β
β β’ Verifies H1 tag structure β
β β’ Analyzes heading hierarchy (H1-H6) β
β β’ Checks robots meta tags and headers β
β β’ Validates canonical URLs β
β β’ Reviews Open Graph meta tags β
β β’ Assesses SEO-friendly URL structure β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π ContentQualityService.php β
β π― CONTENT QUALITY ASSESSOR β
β β’ Counts words and analyzes content length β
β β’ Identifies most frequent words β
β β’ Detects deprecated HTML tags β
β β’ Finds inline CSS usage β
β β’ Scans for plaintext email addresses β
β β’ Calculates text-to-HTML ratio β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β πΌοΈ MediaOptimizationService.php β
β π― MEDIA OPTIMIZATION CHECKER β
β β’ Analyzes image formats (JPG, PNG β WebP, AVIF) β
β β’ Validates alt attributes on images β
β β’ Checks for lazy loading implementation β
β β’ Recommends modern image formats β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π LinkAnalysisService.php β
β π― LINK SECURITY & STRUCTURE ANALYZER β
β β’ Identifies unsafe external links (missing noopener/noreferrer) β
β β’ Counts and categorizes external links β
β β’ Analyzes internal link structure β
β β’ Provides security recommendations β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β‘ TechnicalPerformanceService.php β
β π― TECHNICAL PERFORMANCE AUDITOR β
β β’ Checks robots.txt existence and validity β
β β’ Tests 404 error page handling β
β β’ Analyzes server response headers β
β β’ Measures response time and page size β
β β’ Validates compression (GZIP/Brotli) β
β β’ Checks DOM size and complexity β
β β’ Identifies non-deferred JavaScript β
β β’ Counts HTTP requests β
β β’ Verifies HTTP/2 and HTTPS implementation β
β β’ Validates SSL certificate β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π DATA FLOW β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
URL Input
β
βΌ
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β HTTP Client βββββΆβ Fetches webpage content, headers, response time β
β (Guzzle) β β β
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Cache Layer βββββΆβ Stores results to avoid repeated requests β
β (Laravel Cache) β β β
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Service βββββΆβ Each service analyzes specific aspects: β
β Orchestration β β β’ Document structure, SEO, Content, Media, Links, β
β β β Technical performance β
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Report βββββΆβ Comprehensive audit report with recommendations β
β Generation β β β
βββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π― KEY FEATURES β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
Modular Architecture - Each service handles specific audit concerns
β
Caching Layer - Prevents redundant HTTP requests
β
Comprehensive Coverage - From basic HTML to advanced performance metrics
β
Security Focus - Identifies unsafe links and security vulnerabilities
β
SEO Optimization - Validates all major SEO factors
β
Performance Analysis - Measures technical performance metrics
β
Actionable Recommendations - Provides specific improvement suggestions
Comments
No Comments Yet!
Would you like to be the first?
Comment Moderation is ON for this post. All comments must be approved before they will be visible.