The simplest Net Promoter Score (NPS).
Built with Svelte. Compiles to a single JavaScript file. NPS results are sent to your own Google Analytics account.
- 📦 Single Script Deployment - A single JS file with 0 additional dependencies
- 🌐 Internationalization - Configurable text in multiple languages
- 📊 Google Analytics - Results are sent directly to your Google Analytics
- 🎨 Customizable Theme - Colors, styling, and branding options
- 📱 Responsive Design - Works on desktop and mobile
- ⚡ Lightweight - Minimal footprint, fast loading
- set config
<script>
window.simpleNpsConfig = { gaId : "G-123123123" };
</script>- load the script
<script src="https://cdn.jsdeliver.net/npm/simple-nps@0.0.5/dist/simple-nps.js">Here is the default configuration.
<script>
window.simpleNpsConfig = {
storageKey: 'nps_survey_completed',
i18n: {
en: {
intro: "How likely are you to recommend us?",
notLikely: "Not likely",
extremelyLikely: "Extremely likely",
submitBtn: "Submit",
thankYou: "Thank you for your feedback!",
followUp: "Could you tell us why?",
followUpPlaceholder: "Your feedback helps us improve...",
followUpSubmit: "Submit feedback",
followUpSkip: "Skip",
close: "Close"
}
},
language: 'en',
theme: {
primaryColor: '#007bff',
backgroundColor: '#ffffff',
textColor: '#333333',
borderRadius: '8px'
},
showFollowUp: false,
delay: 1000,
thankYouDuration: 1500
};
</script>Add an optional custom entry point.
<div id="simple-nps"></div>The automatically tracks these GA4 events:
nps_score: When user submits rating (0-10)nps_feedback: When user submits follow-up text, includes the NPS ratingnps_dismissed: When user closes the form without submitting feedback
Scores are automatically categorized:
- Detractors: 0-6 (Red)
- Passives: 7-8 (Yellow/Orange)
- Promoters: 9-10 (Green)
You can view the collected data in your Google Analytics dashboard under the "Events" section.
./packages/script/ # publishable NPS script package
./apps/website/ # SvelteKit docs + demo site