Email Campaign Optimizer

Email Campaign Optimizer

Analyze campaign performance, calculate A/B test significance, and optimize for success.

Campaign Metrics Input

Your campaign analysis will appear here after you click "Analyze Campaign".

${(rateA * 100).toFixed(2)}%

Variation B Conv. Rate

${(rateB * 100).toFixed(2)}%

`; if (isSignificant) { resultHTML += `

Result is Statistically Significant!

With ${confidence.toFixed(2)}% confidence, Variation ${winner} is the winner.

It performed ${uplift}% better than Variation ${loser}.

`; } else { resultHTML += `

Result is Not Statistically Significant.

With only ${confidence.toFixed(2)}% confidence, we cannot be sure the difference is not due to random chance.

Consider running the test longer to gather more data.

`; } resultsDiv.innerHTML = resultHTML; resultsDiv.classList.remove('hidden'); } // PDF Generation Function window.generatePdf = async function() { const { jsPDF } = window.jspdf; const content = document.getElementById('pdf-content'); const buttonContainer = document.getElementById('pdf-button-container'); if (!content) return; // Temporarily hide the button container so it's not in the PDF if (buttonContainer) buttonContainer.style.display = 'none'; try { const canvas = await html2canvas(content, { scale: 2, // Improve resolution useCORS: true, logging: false }); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = pdf.internal.pageSize.getHeight(); const imgWidth = canvas.width; const imgHeight = canvas.height; const ratio = imgWidth / imgHeight; let finalImgWidth = pdfWidth - 20; // with margin let finalImgHeight = finalImgWidth / ratio; // If the image is too tall for the page, scale it down if (finalImgHeight > pdfHeight - 20) { finalImgHeight = pdfHeight - 20; finalImgWidth = finalImgHeight * ratio; } const x = (pdfWidth - finalImgWidth) / 2; pdf.setFont("helvetica", "bold"); pdf.setFontSize(18); pdf.text("Email Campaign Performance Report", pdfWidth / 2, 15, { align: 'center' }); pdf.addImage(imgData, 'PNG', x, 25, finalImgWidth, finalImgHeight); pdf.save('Email-Campaign-Report.pdf'); } catch (error) { console.error("Error generating PDF:", error); alert("Sorry, there was an error generating the PDF. Please try again."); } finally { // Show the button container again if (buttonContainer) buttonContainer.style.display = 'flex'; } } // Initialize the view showTab(0); });
Scroll to Top