Net Promoter Score (NPS) Dashboard
Track and analyze customer loyalty over time.
Overall Net Promoter Score
0
Promoters (9-10)
0
Passives (7-8)
0
Detractors (0-6)
0
NPS Trend Over Time
Response Distribution
Response Network Cluster
Performance Narrative
Add New NPS Score
Recent Responses
| Date | Score | Category | Actions |
|---|
This score indicates a need for improvement. While there are more promoters than detractors, a significant number of customers are not fully satisfied.
`; } else { narrative += `This score is a critical area for focus. There are more unhappy customers than happy ones, posing a risk to brand reputation and growth.
`; } const promoterPercent = ((promoters / totalResponses) * 100).toFixed(1); narrative += `The score is driven by ${promoterPercent}% of respondents being Promoters, while detractors make up ${((detractors / totalResponses) * 100).toFixed(1)}% of the feedback.
`; narrativeContentEl.innerHTML = narrative; }; // --- EVENT HANDLERS --- if (dataForm) { dataForm.addEventListener('submit', function (e) { e.preventDefault(); const newEntry = { id: Date.now(), date: dataForm.date.value, score: parseInt(dataForm.score.value, 10), }; npsData.push(newEntry); dataForm.reset(); renderAll(); }); } window.deleteData = (id) => { npsData = npsData.filter(item => item.id !== id); renderAll(); }; if (pdfDownloadBtn) { pdfDownloadBtn.addEventListener('click', function () { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'landscape', unit: 'pt', format: 'a4' }); const contentToPrint = document.getElementById('dashboard-content'); if (!contentToPrint) return; const elementsToHide = contentToPrint.querySelectorAll('button'); elementsToHide.forEach(el => el.classList.add('pdf-hide')); html2canvas(contentToPrint, { scale: 2, useCORS: true, onclone: (doc) => { Chart.defaults.animation = false; } }) .then(canvas => { elementsToHide.forEach(el => el.classList.remove('pdf-hide')); Chart.defaults.animation = true; const imgData = canvas.toDataURL('image/png'); const imgProps = doc.getImageProperties(imgData); const pdfWidth = doc.internal.pageSize.getWidth() - 40; const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; doc.text(`Net Promoter Score (NPS) Report - ${new Date().toLocaleDateString()}`, 20, 20); doc.addImage(imgData, 'PNG', 20, 40, pdfWidth, pdfHeight); doc.save(`nps-dashboard-report.pdf`); }).catch(err => { elementsToHide.forEach(el => el.classList.remove('pdf-hide')); Chart.defaults.animation = true; console.error("PDF generation error:", err); }); }); } // --- INITIALIZATION --- renderAll(); showTab('dashboard'); });