Free Trial & Subscription Pricing Modeler

Free Trial & Subscription Pricing Modeler

Project key metrics for your SaaS business based on your pricing strategy.

${formatPercent(arrGrowthRate)}

MRR Growth Over ${appData.assumptions.projectionMonths} Months

Subscriber Mix by Tier

`; // Render Charts const mrrCtx = document.getElementById('mrrGrowthChart').getContext('2d'); if (charts.mrr) charts.mrr.destroy(); charts.mrr = new Chart(mrrCtx, { type: 'line', data: { labels: Array.from({ length: appData.assumptions.projectionMonths }, (_, i) => `Month ${i + 1}`), datasets: [{ label: 'MRR', data: mrrTimeline, borderColor: '#16a34a', backgroundColor: 'rgba(22, 163, 74, 0.1)', fill: true, tension: 0.3 }] }, options: { responsive: true, maintainAspectRatio: false, scales: { y: { ticks: { callback: value => formatCurrency(value) }}}} }); const mixCtx = document.getElementById('subscriberMixChart').getContext('2d'); if (charts.mix) charts.mix.destroy(); charts.mix = new Chart(mixCtx, { type: 'doughnut', data: { labels: appData.tiers.map(t => t.name), datasets: [{ data: subscriberMix, backgroundColor: ['#3b82f6', '#10b981', '#f59e0b', '#8b5cf6'] }] }, options: { responsive: true, maintainAspectRatio: false, plugins: { legend: { position: 'bottom' }}} }); document.getElementById('download-pdf-btn').addEventListener('click', generatePdf); }; const renderTiersConfig = () => { const configContent = document.getElementById('content-tiers-config'); if (!configContent) return; let tiersHtml = appData.tiers.map((tier, index) => `
`).join(''); configContent.innerHTML = `

Configure Pricing Tiers

${tiersHtml}
`; }; const renderAssumptionsConfig = () => { const configContent = document.getElementById('content-assumptions-config'); if(!configContent) return; const { assumptions } = appData; configContent.innerHTML = `

Configure Model Assumptions

${Object.entries({ initialVisitors: { label: 'Starting Monthly Visitors', type: 'number' }, visitorToTrialRate: { label: 'Visitor-to-Trial Rate (%)', type: 'number', step: 0.1 }, trialLength: { label: 'Free Trial Length (days)', type: 'number' }, trialToPaidRate: { label: 'Trial-to-Paid Conversion Rate (%)', type: 'number', step: 0.1 }, monthlyChurnRate: { label: 'Monthly Customer Churn Rate (%)', type: 'number', step: 0.1 }, visitorGrowthRate: { label: 'Month-over-Month Visitor Growth (%)', type: 'number', step: 0.1 }, projectionMonths: { label: 'Projection Period (Months)', type: 'number' }, }).map(([key, {label, type, step}]) => `
`).join('')}
`; document.getElementById('run-simulation-btn').addEventListener('click', handleConfigUpdate); }; const handleConfigUpdate = () => { // Update Assumptions Object.keys(appData.assumptions).forEach(key => { const input = document.getElementById(key); if (input) appData.assumptions[key] = parseFloat(input.value) || 0; }); // Update Tiers document.querySelectorAll('#tiers-container > div').forEach((tierEl, index) => { tierEl.querySelectorAll('input').forEach(input => { const field = input.dataset.field; const value = input.type === 'number' ? parseFloat(input.value) : input.value; appData.tiers[index][field] = value; }); }); simulationResult = null; // Force recalculation renderDashboard(); alert('Model updated successfully!'); switchTab(0); }; const generatePdf = () => { loadingOverlay.style.display = 'flex'; const { jsPDF } = window.jspdf; const pdfContent = document.getElementById('pdf-content-area'); const pdfHeader = document.getElementById('pdf-header'); document.getElementById('pdf-generated-date').textContent = new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); pdfHeader.classList.remove('hidden'); html2canvas(pdfContent, { scale: 2, useCORS: true, logging: false }) .then(canvas => { pdfHeader.classList.add('hidden'); const imgData = canvas.toDataURL('image/jpeg', 0.95); const pdf = new jsPDF({ orientation: 'landscape', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgProps = pdf.getImageProperties(imgData); const imgHeight = (imgProps.height * pdfWidth) / imgProps.width; pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, imgHeight); pdf.save('Subscription-Model-Report.pdf'); loadingOverlay.style.display = 'none'; }).catch(err => { console.error("PDF generation failed:", err); pdfHeader.classList.add('hidden'); loadingOverlay.style.display = 'none'; alert('An error occurred generating the PDF.'); }); }; // --- TAB NAVIGATION & INITIALIZATION --- const switchTab = (tabIndex) => { activeTabIndex = tabIndex; document.querySelectorAll('.tab-btn').forEach((btn, i) => btn.classList.toggle('active', i === tabIndex)); document.querySelectorAll('.tab-content').forEach((content, i) => content.classList.toggle('hidden', i !== tabIndex)); updateNavButtons(); }; const updateNavButtons = () => { prevTabBtn.disabled = activeTabIndex === 0; nextTabBtn.disabled = activeTabIndex === tabIdentifiers.length - 1; }; const initializeUI = () => { const tabs = [ { name: 'Dashboard', id: 'dashboard' }, { name: 'Pricing Tiers', id: 'tiers-config' }, { name: 'Model Assumptions', id: 'assumptions-config' } ]; tabIdentifiers = tabs.map(t => t.id); tabsContainer.innerHTML = tabs.map(tab => ``).join(''); mainContent.innerHTML = tabs.map(tab => `
`).join(''); tabs.forEach((tab, index) => { document.getElementById(`tab-${tab.id}`).addEventListener('click', () => switchTab(index)); }); renderDashboard(); renderTiersConfig(); renderAssumptionsConfig(); switchTab(0); }; initializeUI(); lucide.createIcons(); prevTabBtn.addEventListener('click', () => { if (activeTabIndex > 0) switchTab(activeTabIndex - 1); }); nextTabBtn.addEventListener('click', () => { if (activeTabIndex < tabIdentifiers.length - 1) switchTab(activeTabIndex + 1); }); });
Scroll to Top