Brand Voice Consistency Checker

Brand Voice Consistency Checker

Ensure your content perfectly matches your brand's unique voice.

Consistency Analysis Report

Your analysis report will appear here.
Go to 'Data Configuration' to begin.

${analysis.replace(/\n/g, '
')}

`; } const positives = text.match(sections.positives)?.[1]?.trim(); if(positives) { parsedReport.positives = positives; html += `

What Works Well

    ${positives.replace(/- "([^"]+)":/g, '
  • "$1":')}
`; } const improvements = text.match(sections.improvements)?.[1]?.trim(); if(improvements) { parsedReport.improvements = improvements; html += `

Areas for Improvement

    ${improvements.replace(/- "([^"]+)":/g, '
  • "$1":')}
`; } const suggestions = text.match(sections.suggestions)?.[1]?.trim(); if(suggestions) { parsedReport.suggestions = suggestions; html += `

Actionable Suggestions

${suggestions.replace(/\n/g, '
')}

`; } html += '
'; return { parsedReport, html }; } function renderReport(text) { const { parsedReport, html } = parseAndRenderReport(text); if (Object.keys(parsedReport).length > 0) { lastGeneratedReport = parsedReport; previewPlaceholder.classList.add('hidden'); resultsPreview.innerHTML = html; } else { resultsPreview.innerHTML = `

The AI could not generate the report in the expected format. Please try again.

`; } } function showLoadingState(isLoading) { if (isLoading) { previewPlaceholder.classList.add('hidden'); resultsPreview.innerHTML = '
'; generateBtn.disabled = true; generateBtn.textContent = 'Analyzing...'; showFeedback('AI is analyzing your content...', false, 0); } else { generateBtn.disabled = false; generateBtn.textContent = 'Analyze Content'; } } downloadPdfBtn.addEventListener('click', () => { if (!lastGeneratedReport) { showFeedback('Please generate a report before downloading.', true, 3000); return; } showFeedback('Generating PDF...', false, 2000); const { jsPDF } = window.jspdf; const pdf = new jsPDF({ unit: 'pt', format: 'letter' }); const pageMargin = 72; const pageWidth = pdf.internal.pageSize.getWidth(); const contentWidth = pageWidth - pageMargin * 2; let cursorY = pageMargin; const addSection = (title, content, titleSize, contentSize, isList = false) => { if (!content) return; pdf.setFont('Helvetica', 'bold'); pdf.setFontSize(titleSize); let titleLines = pdf.splitTextToSize(title, contentWidth); pdf.setFont('Helvetica', 'normal'); pdf.setFontSize(contentSize); let contentLines = pdf.splitTextToSize( isList ? content.replace(/- /g, '\n• ') : content, contentWidth ); let sectionHeight = (titleLines.length * titleSize * 1.2) + (contentLines.length * contentSize * 1.2) + 20; if (cursorY + sectionHeight > pdf.internal.pageSize.getHeight() - pageMargin) { pdf.addPage(); cursorY = pageMargin; } pdf.setFont('Helvetica', 'bold'); pdf.setFontSize(titleSize); pdf.text(titleLines, pageMargin, cursorY); cursorY += titleLines.length * titleSize * 1.2; pdf.setFont('Helvetica', 'normal'); pdf.setFontSize(contentSize); pdf.text(contentLines, pageMargin, cursorY); cursorY += contentLines.length * contentSize * 1.2 + 25; }; // Add Title pdf.setFont('Helvetica', 'bold'); pdf.setFontSize(22); pdf.text('Brand Voice Consistency Report', pageWidth / 2, cursorY, { align: 'center' }); cursorY += 50; // Add sections addSection('Overall Score', lastGeneratedReport.score, 16, 12); addSection('Detailed Analysis', lastGeneratedReport.analysis, 14, 11); addSection('What Works Well', lastGeneratedReport.positives, 14, 11, true); addSection('Areas for Improvement', lastGeneratedReport.improvements, 14, 11, true); addSection('Actionable Suggestions', lastGeneratedReport.suggestions, 14, 11); pdf.save('brand-voice-report.pdf'); }); let feedbackTimeout; function showFeedback(message, isError = false, duration = 3000) { clearTimeout(feedbackTimeout); feedbackMessage.innerHTML = message; feedbackMessage.style.color = isError ? '#ef4444' : '#4a5568'; if (duration !== 0) { feedbackTimeout = setTimeout(() => { feedbackMessage.innerHTML = ''; }, duration); } } });
Scroll to Top