Blog Call-to-Action (CTA) Generator

Blog Call-to-Action (CTA) Generator

Create powerful CTAs that convert readers into customers.

Please provide an Action Verb and an Offer to generate CTAs.

'; return; } const capVerb = verb.charAt(0).toUpperCase() + verb.slice(1); // Variation 1: Simple & Direct generatedCTAs.push(`${capVerb} ${offer}.`); // Variation 2: Benefit-driven if (goal === 'Generate Leads' || goal === 'Drive Sales') { generatedCTAs.push(`Ready to transform your results? ${capVerb} ${offer} today.`); } else { generatedCTAs.push(`Want to see more? ${capVerb} ${offer} and stay updated.`); } // Variation 3: Tone-based if (tone.includes('Urgent')) { generatedCTAs.push(`Don't wait! ${capVerb} ${offer} now before it's too late.`); } else if (tone.includes('Friendly')) { generatedCTAs.push(`Hey, why not ${verb} ${offer}? You'll love it!`); } else { generatedCTAs.push(`Take the next step. ${capVerb} ${offer} to get started.`); } // Variation 4: Question-based generatedCTAs.push(`What are you waiting for? ${capVerb} ${offer} right now!`); displayResults(); }; const displayResults = () => { if(generatedCTAs.length === 0) { resultsContainer.innerHTML = ''; downloadSection.classList.add('hidden'); return; }; let html = '

Generated CTA Options

'; generatedCTAs.forEach((cta, index) => { html += `

${cta}

`; }); html += '
'; resultsContainer.innerHTML = html; downloadSection.classList.remove('hidden'); // Add event listeners to new copy buttons document.querySelectorAll('.copy-btn').forEach(button => { button.addEventListener('click', (e) => copyToClipboard(e.target)); }); }; const copyToClipboard = (button) => { const targetId = button.dataset.target; const textToCopy = document.getElementById(targetId)?.innerText; if(textToCopy) { // Using document.execCommand for broader compatibility within iFrames const textArea = document.createElement("textarea"); textArea.value = textToCopy; document.body.appendChild(textArea); textArea.select(); try { document.execCommand('copy'); button.textContent = 'Copied!'; setTimeout(() => { button.textContent = 'Copy'; }, 2000); } catch (err) { console.error('Failed to copy text: ', err); button.textContent = 'Error'; } document.body.removeChild(textArea); } }; const downloadPDF = () => { if (generatedCTAs.length === 0) return; const { jsPDF } = window.jspdf; const pdf = new jsPDF({ orientation: 'p', unit: 'pt', format: 'a4' }); const goal = getInput('postGoal'); const tone = getInput('postTone'); const verb = getInput('actionVerb'); const offer = getInput('offer'); const PAGE_WIDTH = pdf.internal.pageSize.getWidth(); const MARGIN = 50; let y = MARGIN; // Header pdf.setFontSize(24); pdf.setFont('helvetica', 'bold'); pdf.setTextColor(5, 150, 105); // emerald-600 pdf.text('Call-to-Action (CTA) Report', PAGE_WIDTH / 2, y, { align: 'center' }); y += 40; // Input Summary pdf.setFontSize(14); pdf.setFont('helvetica', 'bold'); pdf.setTextColor(15, 23, 42); // slate-900 pdf.text('Generation Parameters', MARGIN, y); y += 20; pdf.setFontSize(11); pdf.setFont('helvetica', 'normal'); pdf.setTextColor(51, 65, 85); // slate-600 pdf.text(`Goal: ${goal}`, MARGIN + 10, y); y += 15; pdf.text(`Tone: ${tone}`, MARGIN + 10, y); y += 15; pdf.text(`Action: ${verb}`, MARGIN + 10, y); y += 15; pdf.text(`Offer: ${offer}`, MARGIN + 10, y); y += 40; // Generated CTAs pdf.setFontSize(14); pdf.setFont('helvetica', 'bold'); pdf.setTextColor(15, 23, 42); pdf.text('Generated CTA Options', MARGIN, y); y+= 10; generatedCTAs.forEach((cta, index) => { const textBlockHeight = pdf.splitTextToSize(cta, PAGE_WIDTH - MARGIN*2).length * 12 + 30; if (y + textBlockHeight > pdf.internal.pageSize.getHeight() - MARGIN) { pdf.addPage(); y = MARGIN; } pdf.setDrawColor(203, 213, 225); // slate-300 pdf.line(MARGIN, y, PAGE_WIDTH - MARGIN, y); y += 20; pdf.setFontSize(11); pdf.setFont('helvetica', 'normal'); pdf.setTextColor(51, 65, 85); const ctaLines = pdf.splitTextToSize(cta, PAGE_WIDTH - MARGIN*2 - 10); pdf.text(ctaLines, MARGIN + 10, y); y += ctaLines.length * 12 + 10; }); pdf.line(MARGIN, y-10, PAGE_WIDTH - MARGIN, y-10); pdf.save(`CTA_Options_For_${offer.replace(/ /g, '_').substring(0,20)}.pdf`); }; // --- EVENT LISTENERS --- generateBtn.addEventListener('click', generateCTAsFunc); downloadPdfBtn.addEventListener('click', downloadPDF); });
Scroll to Top