Calculate Days

SEO Real-Time Content Analyzer

Analysis Results

Word Count
0
Keyword Density
0%
function analyzeSEOContent() { var content = document.getElementById('seoContent').value; var keyword = document.getElementById('targetKeyword').value.toLowerCase(); var resultsBox = document.getElementById('seoResults'); var checklist = document.getElementById('seoChecklist'); if (!content || content.trim() === "") { alert("Please enter some content to analyze."); return; } resultsBox.style.display = 'block'; // Basic Metrics var words = content.trim().split(/\s+/); var wordCount = words.length; document.getElementById('resWordCount').innerText = wordCount; var keywordCount = 0; if (keyword) { var regExp = new RegExp(keyword, "gi"); var matches = content.match(regExp); keywordCount = matches ? matches.length : 0; } var density = wordCount > 0 ? ((keywordCount / wordCount) * 100).toFixed(2) : 0; document.getElementById('resDensity').innerText = density + '%'; // SEO Checklist Logic var checks = []; // Word Count Check if (wordCount < 300) { checks.push({ text: "Content length is low (under 300 words). Aim for 600+ for better ranking.", pass: false }); } else { checks.push({ text: "Good content length.", pass: true }); } // Density Check if (keyword) { if (density 3.0) { checks.push({ text: "Keyword density is high (" + density + "%). Watch out for keyword stuffing.", pass: false }); } else { checks.push({ text: "Keyword density is optimized (0.5% – 2.5%).", pass: true }); } } else { checks.push({ text: "No target keyword provided for density analysis.", pass: false }); } // Paragraph Length Check var paragraphs = content.split('\n'); var longPara = false; for (var i = 0; i 150) { longPara = true; break; } } if (longPara) { checks.push({ text: "Some paragraphs are too long. Break them up for readability.", pass: false }); } else { checks.push({ text: "Paragraph structure looks good.", pass: true }); } // Render Checklist checklist.innerHTML = "; for (var j = 0; j < checks.length; j++) { var li = document.createElement('li'); li.style.padding = '8px 0'; li.style.borderBottom = '1px solid #f1f5f9'; li.style.display = 'flex'; li.style.alignItems = 'center'; var icon = checks[j].pass ? '' : ''; li.innerHTML = icon + '' + checks[j].text + ''; checklist.appendChild(li); } }

Leave a Comment