Google Ads Headline Generator
Craft short, powerful headlines for your Google Ads campaigns.
Review your generated headlines. Mix and match them in your Google Ads campaign.
No headlines generated. Please fill out the form.
'; return; } const list = document.createElement('ul'); generatedHeadlines.forEach(headline => { const listItem = document.createElement('li'); listItem.textContent = headline; list.appendChild(listItem); }); elements.outputContainer.innerHTML = ''; elements.outputContainer.appendChild(list); }; const handleDownloadPdf = () => { const { jsPDF } = window.jspdf; if (!jsPDF) { console.error("jsPDF is not loaded."); return; } const doc = new jsPDF({ orientation: 'portrait', unit: 'in', format: 'letter' }); const data = getFormData(); const margin = 0.75; const pageWidth = doc.internal.pageSize.getWidth(); const usableWidth = pageWidth - (margin * 2); let currentY = 0; // PDF Header doc.setFillColor('#f3f4f6'); // gray-100 doc.rect(0, 0, pageWidth, 1.5, 'F'); doc.setDrawColor('#d1d5db'); // gray-300 doc.setLineWidth(0.01); doc.line(0, 1.5, pageWidth, 1.5); doc.setFont('helvetica', 'bold'); doc.setFontSize(22); doc.setTextColor('#1f2937'); // gray-800 doc.text('Google Ads: Ad Group Strategy', margin, 0.9); doc.setFontSize(11); doc.setTextColor('#4b5563'); // gray-600 doc.text(`Product: ${data.productName}`, margin, 1.2); currentY = 1.9; // Campaign Details Section doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.setTextColor('#111827'); // gray-900 doc.text('AD GROUP INPUTS', margin, currentY); currentY += 0.3; const details = [ { label: 'Primary Keyword:', value: data.primaryKeyword }, { label: 'Target Audience:', value: data.targetAudience }, { label: 'Core Benefit/Offer:', value: data.keyBenefit }, ]; doc.setFont('helvetica', 'normal'); doc.setFontSize(10); doc.setTextColor('#374151'); // gray-700 details.forEach(detail => { doc.setFillColor('#eef2ff'); // indigo-50 doc.roundedRect(margin - 0.05, currentY - 0.18, usableWidth + 0.1, 0.25, 0.05, 0.05, 'F'); doc.setFont('helvetica', 'bold'); doc.text(detail.label, margin, currentY); doc.setFont('helvetica', 'normal'); doc.text(detail.value, margin + 2, currentY, { maxWidth: usableWidth - 2.2 }); currentY += 0.4; }); currentY += 0.2; // Generated Headlines Section doc.setFont('helvetica', 'bold'); doc.setFontSize(12); doc.setTextColor('#111827'); // gray-900 doc.text('GENERATED HEADLINE ASSETS', margin, currentY); currentY += 0.3; doc.setFont('helvetica', 'normal'); let col1Y = currentY; let col2Y = currentY; const midpoint = Math.ceil(generatedHeadlines.length / 2); generatedHeadlines.forEach((headline, index) => { if (index < midpoint) { if (col1Y > 10) return; // Stop if column is full doc.text(`• ${headline}`, margin, col1Y); col1Y += 0.25; } else { if (col2Y > 10) return; doc.text(`• ${headline}`, margin + (usableWidth / 2), col2Y); col2Y += 0.25; } }); doc.save('Google-Ads-Headlines.pdf'); }; // --- Event Listeners --- elements.tabDefine.addEventListener('click', () => switchTab('define')); elements.tabReview.addEventListener('click', () => switchTab('review')); elements.nextBtn.addEventListener('click', () => currentTab === 'define' && switchTab('review')); elements.prevBtn.addEventListener('click', () => currentTab === 'review' && switchTab('define')); elements.downloadPdfBtn.addEventListener('click', handleDownloadPdf); });