Calculating Costs of Goods Sold

SEO Content Analyzer

0 / 60 characters
0 / 160 characters

Analysis Report:

function updateSeoCounts() { var title = document.getElementById('seo-title').value; var desc = document.getElementById('seo-desc').value; var titleDiv = document.getElementById('title-count'); var descDiv = document.getElementById('desc-count'); titleDiv.innerHTML = title.length + ' / 60 characters'; titleDiv.style.color = (title.length > 60 || title.length 160 || desc.length < 120) ? '#e11d48' : '#16a34a'; } function analyzeSEOContent() { var bodyText = document.getElementById('seo-body').value.toLowerCase(); var titleText = document.getElementById('seo-title').value.toLowerCase(); var resultsDiv = document.getElementById('seo-results'); var reportContent = document.getElementById('report-content'); if (!bodyText) { alert('Please enter content to analyze.'); return; } var words = bodyText.match(/\w+/g); var wordCount = words ? words.length : 0; // Simple keyword extraction var freq = {}; for (var i = 0; i 3) { freq[w] = (freq[w] || 0) + 1; } } var sortedWords = Object.keys(freq).sort(function(a, b) { return freq[b] – freq[a]; }).slice(0, 3); var html = 'Word Count: ' + wordCount + ' words
'; html += 'Top Keywords: ' + sortedWords.join(', ') + '
'; // Check title focus if (sortedWords.length > 0) { var primary = sortedWords[0]; var inTitle = titleText.indexOf(primary) !== -1; html += 'Keyword in Title: ' + (inTitle ? 'Yes' : 'No (' + primary + ' missing)') + '
'; } // Readability basic var sentenceCount = bodyText.split(/[.!?]+/).length; var avgSentence = wordCount / sentenceCount; html += 'Readability: ' + (avgSentence > 20 ? 'Hard (Long sentences)' : 'Good') + '
'; reportContent.innerHTML = html; resultsDiv.style.display = 'block'; }

Leave a Comment