Net Promoter Score How to Calculate

Net Promoter Score (NPS) Calculator: How to Calculate and Improve :root { –primary-color: #004a99; –success-color: #28a745; –background-color: #f8f9fa; –text-color: #333; –border-color: #ddd; –shadow-color: rgba(0, 0, 0, 0.1); –white: #fff; } body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: var(–background-color); color: var(–text-color); line-height: 1.6; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; } .container { width: 100%; max-width: 1000px; margin: 20px auto; padding: 20px; background-color: var(–white); border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); } header { background-color: var(–primary-color); color: var(–white); padding: 20px 0; text-align: center; width: 100%; margin-bottom: 20px; } header h1 { margin: 0; font-size: 2.5em; } h2, h3 { color: var(–primary-color); margin-top: 1.5em; margin-bottom: 0.5em; } .calculator-section { background-color: var(–white); padding: 30px; border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); margin-bottom: 30px; } .calculator-section h2 { text-align: center; margin-top: 0; margin-bottom: 20px; } .input-group { margin-bottom: 20px; padding: 15px; border: 1px solid var(–border-color); border-radius: 5px; background-color: var(–background-color); } .input-group label { display: block; margin-bottom: 8px; font-weight: bold; color: var(–primary-color); } .input-group input[type="number"], .input-group select { width: calc(100% – 20px); padding: 10px; border: 1px solid var(–border-color); border-radius: 4px; font-size: 1em; margin-top: 5px; } .input-group .helper-text { font-size: 0.85em; color: #666; margin-top: 5px; display: block; } .error-message { color: red; font-size: 0.8em; margin-top: 5px; display: none; /* Hidden by default */ } .button-group { display: flex; justify-content: space-between; margin-top: 25px; gap: 10px; } .button-group button { padding: 12px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 1em; font-weight: bold; transition: background-color 0.3s ease; } .btn-calculate { background-color: var(–primary-color); color: var(–white); } .btn-calculate:hover { background-color: #003366; } .btn-reset { background-color: #6c757d; color: var(–white); } .btn-reset:hover { background-color: #5a6268; } .btn-copy { background-color: var(–success-color); color: var(–white); } .btn-copy:hover { background-color: #218838; } #results { margin-top: 30px; padding: 25px; border: 1px solid var(–border-color); border-radius: 8px; background-color: var(–white); box-shadow: 0 2px 10px var(–shadow-color); text-align: center; } #results h3 { margin-top: 0; color: var(–primary-color); } .result-item { margin-bottom: 15px; padding: 10px; border-bottom: 1px dashed var(–border-color); } .result-item:last-child { border-bottom: none; } .result-label { font-weight: bold; color: var(–primary-color); } .primary-result { font-size: 2.2em; font-weight: bold; color: var(–success-color); background-color: #e9f7ef; padding: 15px 20px; border-radius: 5px; margin-bottom: 20px; display: inline-block; } .formula-explanation { font-size: 0.9em; color: #555; margin-top: 15px; padding: 10px; background-color: #f0f0f0; border-radius: 4px; text-align: left; } #chartContainer { margin-top: 30px; padding: 20px; background-color: var(–white); border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); } #chartContainer h3 { text-align: center; margin-top: 0; } canvas { display: block; margin: 0 auto; max-width: 100%; height: auto !important; /* Ensure canvas scales properly */ } table { width: 100%; border-collapse: collapse; margin-top: 20px; box-shadow: 0 2px 5px var(–shadow-color); } th, td { padding: 12px 15px; text-align: left; border: 1px solid var(–border-color); } thead { background-color: var(–primary-color); color: var(–white); } tbody tr:nth-child(even) { background-color: #f2f2f2; } tbody tr:hover { background-color: #e0e0e0; } .article-content { margin-top: 40px; padding: 30px; background-color: var(–white); border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); } .article-content h2 { border-bottom: 2px solid var(–primary-color); padding-bottom: 5px; margin-bottom: 15px; } .article-content h3 { margin-top: 20px; color: #0056b3; } .article-content p { margin-bottom: 15px; } .article-content ul, .article-content ol { margin-left: 20px; margin-bottom: 15px; } .article-content li { margin-bottom: 8px; } .faq-item { margin-bottom: 15px; padding: 10px; border-left: 3px solid var(–primary-color); background-color: #f9f9f9; border-radius: 4px; } .faq-item strong { color: var(–primary-color); display: block; margin-bottom: 5px; } .internal-links { margin-top: 30px; padding: 20px; background-color: var(–white); border-radius: 8px; box-shadow: 0 2px 10px var(–shadow-color); } .internal-links h3 { text-align: center; margin-top: 0; color: var(–primary-color); } .internal-links ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; } .internal-links li { background-color: var(–primary-color); padding: 10px 15px; border-radius: 5px; transition: background-color 0.3s ease; } .internal-links li:hover { background-color: #003366; } .internal-links a { color: var(–white); text-decoration: none; font-weight: bold; } .internal-links p { font-size: 0.85em; color: #eee; margin-top: 5px; } .variable-table th, .variable-table td { border: 1px solid #ccc; } .variable-table th { background-color: #e0e0e0; } .variable-table td { background-color: var(–white); } .variable-table tr:nth-child(even) { background-color: #f9f9f9; } .variable-table tr:hover { background-color: #f0f0f0; } .chart-caption { font-size: 0.9em; color: #555; margin-top: 10px; text-align: center; display: block; } .summary-text { font-size: 1.1em; color: #444; margin-bottom: 20px; text-align: center; font-style: italic; } @media (max-width: 768px) { header h1 { font-size: 1.8em; } .container { padding: 15px; } .button-group { flex-direction: column; align-items: center; } .button-group button { width: 100%; margin-bottom: 10px; } .button-group button:last-child { margin-bottom: 0; } .primary-result { font-size: 1.8em; } }

Net Promoter Score (NPS) Calculator

Calculate your Net Promoter Score (NPS) instantly and understand customer loyalty.

Calculate Your Net Promoter Score (NPS)

Customers who are highly satisfied and likely to recommend.
Customers who are satisfied but not enthusiastic.
Customers who are dissatisfied and unlikely to recommend.

Your NPS Results

Net Promoter Score (NPS):
Promoters (%):
Passives (%):
Detractors (%):
Total Respondents:
Formula: NPS = (% Promoters – % Detractors)

Calculation Steps:
  1. Calculate the percentage of Promoters: (Number of Promoters / Total Respondents) * 100
  2. Calculate the percentage of Detractors: (Number of Detractors / Total Respondents) * 100
  3. Subtract the Detractor percentage from the Promoter percentage to get the NPS.

NPS Distribution

Distribution of customer feedback scores.

NPS Variables

Variable Meaning Unit Typical Range
Promoters Customers who rate 9 or 10 on a 0-10 scale. Count ≥ 0
Passives Customers who rate 7 or 8 on a 0-10 scale. Count ≥ 0
Detractors Customers who rate 0-6 on a 0-10 scale. Count ≥ 0
Total Respondents Sum of Promoters, Passives, and Detractors. Count ≥ 0
NPS Net Promoter Score. Score -100 to +100

What is Net Promoter Score (NPS)?

The Net Promoter Score (NPS) is a widely adopted customer loyalty metric used to gauge the willingness of customers to recommend a company's products or services to others. Developed by Fred Reichheld, it's a simple yet powerful indicator of customer satisfaction and a predictor of business growth. NPS is based on a single question: "On a scale of 0 to 10, how likely are you to recommend [Company/Product/Service] to a friend or colleague?"

Customers are categorized into three groups based on their responses:

  • Promoters (Score 9-10): Loyal enthusiasts who will keep buying and refer others, fueling growth.
  • Passives (Score 7-8): Satisfied but unenthusiastic customers who are vulnerable to competitive offerings.
  • Detractors (Score 0-6): Unhappy customers who can damage your brand and impede growth through negative word-of-mouth.

The Net Promoter Score (NPS) is calculated by subtracting the percentage of Detractors from the percentage of Promoters. This score ranges from -100 to +100. A positive NPS indicates more Promoters than Detractors, suggesting strong customer loyalty and potential for growth. A negative NPS signals a need for significant improvements in customer experience.

Who Should Use NPS?

Virtually any business that interacts with customers can benefit from measuring NPS. This includes:

  • SaaS companies tracking user satisfaction.
  • Retailers assessing shopper loyalty.
  • Service providers (e.g., banks, telecom, airlines) understanding customer advocacy.
  • B2B organizations gauging partner and client relationships.
  • Startups validating product-market fit and early customer sentiment.

Regularly tracking NPS helps businesses identify areas for improvement, benchmark against competitors, and ultimately foster a more customer-centric culture. Understanding how to calculate net promoter score is the first step towards leveraging this powerful metric.

Common Misconceptions about NPS

Several common misunderstandings can hinder the effective use of NPS:

  • NPS is the only metric that matters: While important, NPS should complement other customer feedback and operational metrics.
  • A high NPS guarantees success: A high score is meaningless without understanding the underlying reasons and taking action.
  • NPS is a vanity metric: If not acted upon, it can be. However, when used strategically, it drives tangible business outcomes.
  • The score itself is the goal: The true value lies in the insights gained and the improvements made based on customer feedback.

Net Promoter Score (NPS) Formula and Mathematical Explanation

Understanding how to calculate Net Promoter Score (NPS) is straightforward. The formula is designed to provide a clear, concise measure of customer loyalty. It relies on segmenting customers into three distinct groups based on their response to the likelihood-to-recommend question.

Step-by-Step Derivation

  1. Gather Responses: Collect responses to the NPS question, "On a scale of 0 to 10, how likely are you to recommend [Company/Product/Service]?"
  2. Categorize Customers:
    • Promoters: Customers who answered 9 or 10.
    • Passives: Customers who answered 7 or 8.
    • Detractors: Customers who answered 0 to 6.
  3. Calculate Total Respondents: Sum the number of Promoters, Passives, and Detractors. This gives you the total number of individuals surveyed.
  4. Calculate Percentage of Promoters: Divide the number of Promoters by the Total Respondents and multiply by 100.
    % Promoters = (Number of Promoters / Total Respondents) * 100
  5. Calculate Percentage of Detractors: Divide the number of Detractors by the Total Respondents and multiply by 100.
    % Detractors = (Number of Detractors / Total Respondents) * 100
  6. Calculate NPS: Subtract the Percentage of Detractors from the Percentage of Promoters.
    NPS = % Promoters – % Detractors

The resulting NPS score will fall between -100 (if every customer is a Detractor) and +100 (if every customer is a Promoter).

Variable Explanations

The core components of the NPS calculation are the counts of each customer category and the total number of respondents.

Variable Meaning Unit Typical Range
Promoters Customers who rate 9 or 10 on a 0-10 scale, indicating high satisfaction and likelihood to recommend. Count ≥ 0
Passives Customers who rate 7 or 8 on a 0-10 scale, indicating satisfaction but lack of enthusiasm. They are not actively promoting but are not detractors either. Count ≥ 0
Detractors Customers who rate 0-6 on a 0-10 scale, indicating dissatisfaction and potential for negative word-of-mouth. Count ≥ 0
Total Respondents The sum of all customers surveyed (Promoters + Passives + Detractors). This is the denominator for calculating percentages. Count ≥ 0
NPS Net Promoter Score, calculated as (% Promoters – % Detractors). It measures overall customer loyalty. Score -100 to +100

Practical Examples (Real-World Use Cases)

Let's illustrate how to calculate Net Promoter Score (NPS) with practical examples.

Example 1: A Growing E-commerce Store

An online clothing retailer, "StyleSphere," recently surveyed 500 of its customers. Here are the results:

  • Number of Promoters (Score 9-10): 250
  • Number of Passives (Score 7-8): 150
  • Number of Detractors (Score 0-6): 100

Calculation:

  1. Total Respondents = 250 (Promoters) + 150 (Passives) + 100 (Detractors) = 500
  2. % Promoters = (250 / 500) * 100 = 50%
  3. % Detractors = (100 / 500) * 100 = 20%
  4. NPS = 50% – 20% = 30

Interpretation: StyleSphere has an NPS of 30. This is considered a "Good" score. It indicates that they have significantly more Promoters than Detractors, suggesting a healthy level of customer loyalty. However, with 20% Detractors, there's still room for improvement to convert unhappy customers and reduce negative feedback. They might investigate the reasons behind the Detractor scores to address specific issues.

Example 2: A Subscription Software Company

"CodeCrafters," a SaaS provider, surveyed 200 of its users. The results are:

  • Number of Promoters (Score 9-10): 60
  • Number of Passives (Score 7-8): 70
  • Number of Detractors (Score 0-6): 70

Calculation:

  1. Total Respondents = 60 (Promoters) + 70 (Passives) + 70 (Detractors) = 200
  2. % Promoters = (60 / 200) * 100 = 30%
  3. % Detractors = (70 / 200) * 100 = 35%
  4. NPS = 30% – 35% = -5

Interpretation: CodeCrafters has an NPS of -5. This score is considered "Poor" and indicates that there are more Detractors than Promoters. This is a critical warning sign. The company needs to urgently investigate the root causes of customer dissatisfaction. Focusing on improving the user experience, customer support, and product features that lead to negative feedback is essential. They should also aim to increase the number of Promoters by delighting their existing customer base. This example highlights why understanding how to calculate net promoter score is crucial for identifying business challenges.

How to Use This Net Promoter Score (NPS) Calculator

Our Net Promoter Score (NPS) calculator is designed for simplicity and speed, allowing you to quickly understand your customer loyalty. Follow these steps to get your NPS:

  1. Input Your Data:
    • In the "Number of Promoters" field, enter the count of customers who gave you a score of 9 or 10.
    • In the "Number of Passives" field, enter the count of customers who gave you a score of 7 or 8.
    • In the "Number of Detractors" field, enter the count of customers who gave you a score of 0 to 6.
    Ensure you are using the raw counts from your customer surveys.
  2. Calculate NPS: Click the "Calculate NPS" button. The calculator will instantly process your numbers.
  3. Review Your Results:
    • Net Promoter Score (NPS): This is your primary score, displayed prominently. A score above 0 is generally considered good, with scores above 50 often seen as excellent.
    • Promoters (%), Passives (%), Detractors (%): These show the distribution of your customer feedback as percentages of the total respondents.
    • Total Respondents: The sum of all your input numbers.
    The calculator also provides a brief explanation of the NPS formula and displays a chart visualizing the distribution of your customer feedback.
  4. Interpret the Score: Use the NPS score and percentages to understand your current customer loyalty. A positive score is good, but a high number of Detractors warrants immediate attention.
  5. Take Action: Use the insights gained to improve your products, services, and customer support. Engage with Detractors to understand their issues and with Passives to convert them into Promoters.
  6. Reset or Copy: Use the "Reset" button to clear the fields and start over with new data. Use the "Copy Results" button to easily share your calculated NPS and key metrics.

By regularly using this calculator and acting on the insights, you can effectively monitor and improve your customer relationships, driving sustainable business growth. Understanding how to calculate net promoter score is just the beginning; the real value comes from the actions you take.

Key Factors That Affect NPS Results

While the NPS calculation itself is simple, the factors influencing the scores are complex and multifaceted. Understanding these can help businesses interpret their NPS results more accurately and identify areas for improvement.

  1. Product/Service Quality: This is often the most significant driver. A high-quality, reliable product or service that meets or exceeds customer expectations naturally leads to more Promoters. Conversely, bugs, defects, or unmet needs will generate Detractors.
  2. Customer Service Experience: The quality of interactions with support staff, sales teams, and any customer-facing personnel is crucial. Responsive, empathetic, and effective problem-solving can turn a potentially negative experience into a positive one, influencing NPS. Poor service is a common reason for detractors.
  3. Ease of Use (Usability): For software, apps, or complex products, how easy it is for customers to use and achieve their goals directly impacts satisfaction. A steep learning curve or confusing interface can frustrate users, leading to lower scores.
  4. Value for Money: Customers assess whether the perceived benefits of a product or service outweigh its cost. If customers feel they are overpaying or not getting sufficient value, they are more likely to become Detractors, even if the product functions correctly. This relates to pricing strategies and perceived ROI.
  5. Brand Reputation and Trust: A company's overall image, ethical practices, and perceived trustworthiness play a role. Negative press, data breaches, or a history of poor customer treatment can sour customer sentiment, impacting NPS regardless of individual product experiences.
  6. Onboarding and Implementation: For complex products or services, the initial setup and onboarding process are critical. A smooth, supportive onboarding experience sets a positive tone, while a difficult or unsupported one can immediately create Detractors.
  7. Communication and Transparency: How a company communicates updates, issues, or changes can significantly affect customer perception. Proactive, honest communication, especially during service disruptions or product issues, can mitigate negative sentiment and even foster goodwill.
  8. Competitive Landscape: Customers often compare their experience with alternatives. If competitors offer superior features, better pricing, or a more seamless experience, even a satisfactory product might result in a lower NPS as customers perceive better options elsewhere.

By focusing on these key areas, businesses can implement targeted strategies to improve their customer experience and, consequently, their Net Promoter Score.

Frequently Asked Questions (FAQ)

Q1: What is a "good" NPS score?

A "good" NPS score varies by industry, but generally, a score above 0 is considered positive. Scores above 30 are often seen as good, and scores above 50 as excellent. The ultimate goal is to be better than your competitors and to continuously improve your score.

Q2: Can NPS be negative?

Yes, NPS can be negative. This occurs when the percentage of Detractors is higher than the percentage of Promoters. A negative NPS indicates significant customer dissatisfaction and a critical need for improvement.

Q3: How often should I measure NPS?

The frequency depends on your business model and customer lifecycle. For businesses with frequent interactions (e.g., retail, SaaS), quarterly or even monthly surveys might be appropriate. For longer sales cycles or less frequent interactions, annually or semi-annually could suffice. Consistency is key for tracking trends.

Q4: Should I ask follow-up questions with NPS?

Absolutely. While the core NPS question measures likelihood to recommend, asking a follow-up question like "What is the primary reason for your score?" provides crucial qualitative feedback. This helps you understand *why* customers are Promoters, Passives, or Detractors, enabling targeted improvements.

Q5: How do I handle Detractor feedback?

It's vital to follow up with Detractors promptly. Reach out to understand their specific issues, apologize for their negative experience, and attempt to resolve their problems. This not only helps retain the customer but can also turn a negative experience into a positive one, potentially improving future NPS scores.

Q6: What is the difference between NPS and CSAT (Customer Satisfaction)?

NPS measures customer loyalty and the likelihood to recommend, focusing on long-term relationship health. CSAT typically measures satisfaction with a specific interaction or product feature, focusing on immediate sentiment. Both are valuable but serve different purposes.

Q7: Does NPS apply to B2B businesses?

Yes, NPS is highly effective for B2B businesses. It can measure the loyalty of clients, partners, or even employees. Understanding B2B client advocacy is crucial for retention, referrals, and contract renewals.

Q8: How can I improve my NPS score?

Improving NPS involves a holistic approach: enhance product/service quality, provide exceptional customer support, simplify user experience, offer competitive value, build a strong brand reputation, and actively listen to and act on customer feedback, especially from Detractors.

Q9: What is the role of Passives in NPS?

Passives (scoring 7-8) are satisfied but not enthusiastic. They are unlikely to recommend your brand and are vulnerable to competitors. While they don't actively harm your reputation like Detractors, converting them into Promoters through enhanced value or experience is a key strategy for growth.

© 2023 Your Company Name. All rights reserved.

var chartInstance = null; // Global variable to hold chart instance function validateInput(value, id, errorId, min = 0) { var errorElement = document.getElementById(errorId); errorElement.style.display = 'none'; // Hide error by default if (value === "") { errorElement.textContent = "This field cannot be empty."; errorElement.style.display = 'block'; return false; } var numValue = parseFloat(value); if (isNaN(numValue)) { errorElement.textContent = "Please enter a valid number."; errorElement.style.display = 'block'; return false; } if (numValue 0) { promotersPercent = (numPromoters / totalRespondents) * 100; passivesPercent = (numPassives / totalRespondents) * 100; detractorsPercent = (numDetractors / totalRespondents) * 100; } var nps = promotersPercent – detractorsPercent; document.getElementById("npsResult").textContent = nps.toFixed(0); // NPS is usually an integer document.getElementById("promotersPercent").textContent = promotersPercent.toFixed(1) + "%"; document.getElementById("passivesPercent").textContent = passivesPercent.toFixed(1) + "%"; document.getElementById("detractorsPercent").textContent = detractorsPercent.toFixed(1) + "%"; document.getElementById("totalRespondents").textContent = totalRespondents; updateChart([promotersPercent, passivesPercent, detractorsPercent], ["Promoters", "Passives", "Detractors"]); } function resetCalculator() { document.getElementById("promoters").value = "75"; document.getElementById("passives").value = "20"; document.getElementById("detractors").value = "5"; // Clear error messages document.getElementById("promotersError").textContent = ""; document.getElementById("promotersError").style.display = 'none'; document.getElementById("passivesError").textContent = ""; document.getElementById("passivesError").style.display = 'none'; document.getElementById("detractorsError").textContent = ""; document.getElementById("detractorsError").style.display = 'none'; calculateNPS(); // Recalculate with default values } function copyResults() { var npsResult = document.getElementById("npsResult").textContent; var promotersPercent = document.getElementById("promotersPercent").textContent; var passivesPercent = document.getElementById("passivesPercent").textContent; var detractorsPercent = document.getElementById("detractorsPercent").textContent; var totalRespondents = document.getElementById("totalRespondents").textContent; if (npsResult === "-") { alert("No results to copy yet. Please calculate first."); return; } var assumptions = "NPS Calculation Assumptions:\n"; assumptions += "- Promoters: " + document.getElementById("promoters").value + "\n"; assumptions += "- Passives: " + document.getElementById("passives").value + "\n"; assumptions += "- Detractors: " + document.getElementById("detractors").value + "\n"; var resultsText = "NPS Results:\n"; resultsText += "Net Promoter Score (NPS): " + npsResult + "\n"; resultsText += "Promoters: " + promotersPercent + "\n"; resultsText += "Passives: " + passivesPercent + "\n"; resultsText += "Detractors: " + detractorsPercent + "\n"; resultsText += "Total Respondents: " + totalRespondents + "\n\n"; resultsText += assumptions; navigator.clipboard.writeText(resultsText).then(function() { // Optionally provide user feedback, e.g., a temporary message var copyButton = document.querySelector('.btn-copy'); var originalText = copyButton.textContent; copyButton.textContent = 'Copied!'; setTimeout(function() { copyButton.textContent = originalText; }, 2000); }).catch(function(err) { console.error('Failed to copy text: ', err); alert('Failed to copy results. Please try again.'); }); } function updateChart(data, labels) { var ctx = document.getElementById('npsChart').getContext('2d'); // Destroy previous chart instance if it exists if (chartInstance) { chartInstance.destroy(); } chartInstance = new Chart(ctx, { type: 'bar', // Use bar chart for distribution data: { labels: labels, datasets: [{ label: 'Percentage of Respondents', data: data, backgroundColor: [ 'rgba(40, 167, 69, 0.7)', // Green for Promoters 'rgba(255, 193, 7, 0.7)', // Yellow for Passives 'rgba(220, 53, 69, 0.7)' // Red for Detractors ], borderColor: [ 'rgba(40, 167, 69, 1)', 'rgba(255, 193, 7, 1)', 'rgba(220, 53, 69, 1)' ], borderWidth: 1 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { beginAtZero: true, ticks: { callback: function(value) { return value + '%'; } } } }, plugins: { legend: { display: true, position: 'top', }, tooltip: { callbacks: { label: function(context) { var label = context.dataset.label || "; if (label) { label += ': '; } if (context.parsed.y !== null) { label += context.parsed.y.toFixed(1) + '%'; } return label; } } } } } }); } // Initial calculation on page load with default values document.addEventListener('DOMContentLoaded', function() { calculateNPS(); }); // Add event listeners for real-time updates (optional, but good UX) document.getElementById("promoters").addEventListener("input", calculateNPS); document.getElementById("passives").addEventListener("input", calculateNPS); document.getElementById("detractors").addEventListener("input", calculateNPS); // Basic Chart.js integration (ensure Chart.js library is loaded externally or included) // For this self-contained HTML, we'll assume Chart.js is available or provide a placeholder. // In a real-world scenario, you'd include Chart.js via CDN or local file. // For this example, we'll simulate Chart.js availability. // Placeholder for Chart.js library if not externally included if (typeof Chart === 'undefined') { console.warn("Chart.js library not found. Chart will not render."); // You might want to display a message to the user or handle this gracefully. var canvas = document.getElementById('npsChart'); if (canvas) { canvas.style.display = 'none'; // Hide canvas if Chart.js is missing var chartCaption = document.querySelector('.chart-caption'); if (chartCaption) { chartCaption.textContent = "Chart rendering requires Chart.js library."; } } } <!– –>

Leave a Comment