Smart ROI Analyzer for Affiliate Campaigns

Smart ROI Analyzer for Affiliate Campaigns

Calculate key metrics to measure the profitability of your campaigns.

No campaign data found. Add a campaign to get started.

Average CPA

${averageCpaEl.textContent}
`; document.getElementById('pdf-chart-img').src = roiChart.toBase64Image(); const tableHTML = `${state.campaigns.map(c => ``).join('')}
CampaignROINet ProfitCPARevenueCosts
${c.name}${c.roi.toFixed(1)}%$${c.netProfit.toFixed(2)}$${c.cpa.toFixed(2)} $${c.revenue.toFixed(2)}$${c.totalCosts.toFixed(2)}
`; document.getElementById('pdf-table-container').innerHTML = tableHTML; // 2. Render and save const pdfContainer = document.getElementById('pdf-container'); pdfContainer.classList.remove('invisible', '-left-[9999px]'); try { const canvas = await html2canvas(document.getElementById('pdf-report'), { scale: 2 }); const imgData = canvas.toDataURL('image/jpeg', 0.9); const pdf = new jsPDF({ orientation: 'p', unit: 'px', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const pdfHeight = (canvas.height * pdfWidth) / canvas.width; pdf.addImage(imgData, 'JPEG', 0, 0, pdfWidth, pdfHeight); pdf.save('Affiliate_ROI_Analysis_Report.pdf'); } catch (error) { console.error("PDF generation failed:", error); } finally { pdfContainer.classList.add('invisible', '-left-[9999px]'); } } initialize(); });
Scroll to Top