Keyword Intent Classification Tool
Understand the "why" behind any search query to tailor your content.
Intent Analysis for: ""
Primary Intent
Intent Score Breakdown
Enter a query to classify its search intent.
Search Intent Analysis Report
Query: ""
Generated on:
Primary Intent
Score Breakdown
Classifying intent...
'; placeholder.classList.remove('hidden'); resultsContainer.classList.add('hidden'); setTimeout(() => { currentAnalysis = classifyQuery(query); renderResults(currentAnalysis); placeholder.classList.add('hidden'); resultsContainer.classList.remove('hidden'); }, 1500); }; const handleDownloadPdf = () => { const pdfContentEl = document.getElementById('pdf-content'); if (!pdfContentEl) return; document.getElementById('pdf-timestamp').textContent = new Date().toLocaleString('en-US'); document.getElementById('pdf-query-title').textContent = currentAnalysis.query; document.getElementById('pdf-primary-intent').textContent = currentAnalysis.primaryIntent; document.getElementById('pdf-explanation').textContent = intentConfig[currentAnalysis.primaryIntent].explanation; document.getElementById('pdf-breakdown-container').innerHTML = Object.entries(currentAnalysis.scores) .map(([intent, score]) => `${intent}: ${score}%
`).join(''); pdfContentEl.classList.remove('hidden'); html2canvas(pdfContentEl, { scale: 2 }).then(canvas => { pdfContentEl.classList.add('hidden'); const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'portrait', unit: 'pt', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const margin = 40; const imgWidth = pdfWidth - (margin * 2); const imgHeight = (canvas.height * imgWidth) / canvas.width; pdf.addImage(imgData, 'PNG', margin, margin, imgWidth, imgHeight); pdf.save(`${currentAnalysis.query.replace(/\s+/g, '-')}-intent-report.pdf`); }).catch(err => { console.error("Error generating PDF:", err); pdfContentEl.classList.add('hidden'); }); }; // --- Attach Event Listeners --- classifyBtn.addEventListener('click', handleClassify); queryInput.addEventListener('keypress', (e) => { if (e.key === 'Enter') handleClassify(); }); pdfBtn.addEventListener('click', handleDownloadPdf); });