SEO Meta Description Optimizer
Ensure your snippets are perfectly optimized for Google search results to maximize Click-Through Rate (CTR).
function processSEOUpdate() {
var inputElement = document.getElementById(‘seo-meta-input’);
var countDisplay = document.getElementById(‘seo-char-count’);
var previewDisplay = document.getElementById(‘seo-google-preview’);
var indicator = document.getElementById(‘seo-status-indicator’);
var textValue = inputElement.value;
var textLength = textValue.length;
countDisplay.innerText = textLength;
if (textValue.trim() === ”) {
previewDisplay.innerText = ‘Your meta description will appear here as it would in Google Search Results…’;
indicator.innerText = ‘Empty’;
indicator.style.background = ‘#edf2f7’;
indicator.style.color = ‘#4a5568’;
} else {
previewDisplay.innerText = textValue;
if (textLength = 120 && textLength <= 160) {
indicator.innerText = 'Excellent';
indicator.style.background = '#c6f6d5';
indicator.style.color = '#2f855a';
} else {
indicator.innerText = 'Truncated';
indicator.style.background = '#fed7d7';
indicator.style.color = '#c53030';
}
}
}
function resetSEOFields() {
var input = document.getElementById('seo-meta-input');
input.value = '';
processSEOUpdate();
input.focus();
}
function copySEOContent() {
var copyText = document.getElementById('seo-meta-input');
if (copyText.value.trim() === '') return;
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand('copy');
var btn = event.target;
var originalText = btn.innerText;
btn.innerText = '✓ Copied to Clipboard';
btn.style.background = '#2f855a';
setTimeout(function() {
btn.innerText = originalText;
btn.style.background = '#3182ce';
}, 2000);
}