Instagram Ad Caption Generator

Instagram Ad Caption Generator

Generate engaging captions to stop the scroll and drive action.

Please enter a product or service name.

'; return; } const hashtags = `#${product.replace(/\s+/g, '')} #${audience.split(' ')[0]} #${offer.split(' ')[0].replace('%','')}offer #ad`; let captionsHTML = ''; const templates = [ // Template 1: Problem/Solution { Excited: `Tired of the same old morning routine? ☀️ Supercharge your day with the ${product}! It's the perfect solution for ${audience}. ✨`, Sophisticated: `Elevate your daily ritual. The ${product} is meticulously crafted for discerning ${audience} who appreciate quality.`, Playful: `Your mornings are about to get a whole lot better. 😉 Say hello to the ${product}, your new secret weapon.`, Urgent: `Stop settling for less. The ${product} is the upgrade you need, designed for ${audience}. Don't wait.` }, // Template 2: Benefit-driven { Excited: `Imagine starting your day feeling energized and inspired! That's the power of the ${product}. 🚀 Get ready to conquer your goals!`, Sophisticated: `Experience unparalleled quality and convenience. The ${product} seamlessly integrates into the lifestyle of ${audience}.`, Playful: `What if we told you there's an easier way to enjoy the best? The ${product} is here to prove it. You can thank us later.`, Urgent: `This is the moment to transform your routine. The ${product} delivers results, fast. The time for change is now.` }, // Template 3: Direct Offer { Excited: `BIG NEWS! 🎉 For a limited time, ${offer.toLowerCase()} when you try the ${product}! This is the sign you've been waiting for!`, Sophisticated: `An exclusive invitation for you. We are pleased to present the ${product} with a special introductory offer: ${offer}.`, Playful: `We're feeling generous... so we're giving you ${offer.toLowerCase()} on the amazing ${product}. What are you waiting for?`, Urgent: `This won't last! Claim your exclusive offer: ${offer} on the incredible ${product}. Act fast before it's gone!` } ]; templates.forEach((template, index) => { captionsHTML += `

Caption Option ${index + 1}

${template[tone]}

Ready to upgrade? Tap the link in our bio to ${cta}!

${hashtags}

`; }); captionsContainer.innerHTML = captionsHTML; outputTitle.textContent = `Generated Captions for: ${product}`; downloadPdfBtn.classList.remove('hidden'); }; const downloadPdf = () => { const { jsPDF } = window.jspdf; const doc = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const content = getEl('generated-captions-container'); const title = `Instagram Ad Copy: ${productNameInput.value.trim()}`; const genDate = new Date().toLocaleDateString('en-US'); const pageWidth = doc.internal.pageSize.getWidth(); const margin = 15; // --- PDF Template: Social Media Content Plan --- doc.setFillColor(192, 38, 211); // Fuchsia-500 doc.rect(0, 0, pageWidth, 28, 'F'); doc.addImage('data:image/svg+xml;charset=UTF-8,', 'SVG', margin, 7, 14, 14); doc.setFont('helvetica', 'bold'); doc.setFontSize(16); doc.setTextColor(255, 255, 255); doc.text("SOCIAL MEDIA CONTENT PLAN", margin + 18, 16); doc.setFont('helvetica', 'bold'); doc.setFontSize(14); doc.setTextColor(15, 23, 42); // Slate-900 let startY = 40; doc.text(title, margin, startY); doc.setFont('helvetica', 'normal'); doc.setFontSize(9); doc.setTextColor(71, 85, 105); // Slate-500 doc.text(`Generated on: ${genDate}`, pageWidth - margin, startY, { align: 'right' }); startY += 8; html2canvas(content, { scale: 2, useCORS: true }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const imgProps = doc.getImageProperties(imgData); const pdfWidth = pageWidth - (margin * 2); const pdfHeight = (imgProps.height * pdfWidth) / imgProps.width; doc.addImage(imgData, 'PNG', margin, startY, pdfWidth, pdfHeight); // Footer doc.setFontSize(8); doc.setTextColor(100, 116, 139); // Slate-500 doc.text(`Content for ${productNameInput.value.trim()}`, margin, 285); doc.text(`Page 1 of 1`, pageWidth - margin, 285, { align: 'right' }); doc.save(`Instagram_Captions_${productNameInput.value.trim().replace(/\s/g, '_')}.pdf`); }).catch(err => { console.error("Error generating PDF:", err); alert("Could not generate PDF. See console for details."); }); }; const showTab = (tabNum) => { currentTab = tabNum; tabButtons.forEach(btn => btn.classList.toggle('active', parseInt(btn.dataset.tab) === tabNum)); tabPanes.forEach(pane => pane.classList.toggle('hidden', parseInt(pane.id.split('-')[2]) !== tabNum)); prevBtn.classList.toggle('invisible', currentTab === 1); nextBtn.textContent = currentTab === 1 ? 'Generate Captions' : 'Generate Again'; }; // --- Event Listeners --- tabButtons.forEach(button => { button.addEventListener('click', () => { const tabNum = parseInt(button.dataset.tab); if (tabNum === 2 && currentTab === 1) generateCaptions(); showTab(tabNum); }); }); prevBtn.addEventListener('click', () => { if (currentTab > 1) showTab(currentTab - 1) }); nextBtn.addEventListener('click', () => { if (currentTab === 1) { generateCaptions(); showTab(2); } else { generateCaptions(); } }); downloadPdfBtn.addEventListener('click', downloadPdf); // --- Initial Setup --- showTab(1); });
Scroll to Top