AIDA Copy Generator

AIDA Copy Generator

Create high-converting copy using the classic marketing framework.

${generatedCopy.action}

`; }; copyBtn.addEventListener('click', () => { if (generatedCopy.attention) { const fullText = Object.values(generatedCopy).slice(0, 4).join('\n\n'); const tempTextarea = document.createElement('textarea'); tempTextarea.value = fullText; document.body.appendChild(tempTextarea); tempTextarea.select(); document.execCommand('copy'); document.body.removeChild(tempTextarea); const msgEl = document.getElementById('copy-success-msg'); msgEl.textContent = 'Copied to clipboard!'; setTimeout(() => { msgEl.textContent = ''; }, 3000); } }); const updateEmptyState = () => { const hasCopy = Object.keys(generatedCopy).length > 0; document.getElementById('report-content-area').style.display = hasCopy ? 'block' : 'none'; document.getElementById('report-empty-state').style.display = hasCopy ? 'none' : 'block'; downloadPdfBtn.style.display = hasCopy ? 'flex' : 'none'; }; // --- PDF Generation --- downloadPdfBtn.addEventListener('click', () => { const { jsPDF } = window.jspdf; if (!jsPDF || !generatedCopy.attention) return; const doc = new jsPDF(); let yPos = 20; const addText = (text, size, weight, margin) => { if (yPos > 260) { doc.addPage(); yPos = 20; } doc.setFontSize(size); doc.setFont('helvetica', weight); const splitText = doc.splitTextToSize(text, 180); doc.text(splitText, 15, yPos); yPos += (splitText.length * (size / 2.5)) + margin; }; addText(`AIDA Copy for: ${generatedCopy.inputs.product}`, 18, 'bold', 15); addText('Attention', 14, 'bold', 4); addText(generatedCopy.attention, 11, 'normal', 10); addText('Interest', 14, 'bold', 4); addText(generatedCopy.interest, 11, 'normal', 10); addText('Desire', 14, 'bold', 4); addText(generatedCopy.desire, 11, 'normal', 10); addText('Action', 14, 'bold', 4); addText(generatedCopy.action, 11, 'normal', 10); doc.save(`AIDA-Copy-${generatedCopy.inputs.product.replace(/\s+/g, '-')}.pdf`); }); // --- Initialization --- updateEmptyState(); switchTab('generator'); });
Scroll to Top