Smart Product Listing Optimization Tool

Smart Product Listing Optimization Tool

Analyze and improve your product listings for better visibility and conversion.

No significant strengths identified.

`; const recsList = document.getElementById('recommendations-list'); recsList.innerHTML = recommendations.length > 0 ? renderList(recommendations, 'yellow').replace(/M5 13l4 4L19 7/g, 'M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z') : `

No specific recommendations. Great job!

`; // Chart if (scoreBreakdownChart) scoreBreakdownChart.destroy(); scoreBreakdownChart = new Chart(document.getElementById('score-breakdown-chart').getContext('2d'), { type: 'bar', data: { labels: ['Title', 'Description', 'Keywords', 'Media'], datasets: [{ data: [scores.title, scores.description, scores.keywords, scores.media], backgroundColor: ['#60a5fa', '#a78bfa', '#fbbf24', '#f87171'] }] }, options: { responsive: true, plugins: { legend: { display: false } }, scales: { y: { beginAtZero: true, max: 100 } } } }); }; // --- EVENT HANDLERS --- const handleNavClick = (direction) => { const currentIndex = TABS.indexOf(currentTab); const newIndex = direction === 'next' ? currentIndex + 1 : currentIndex - 1; if (newIndex >= 0 && newIndex < TABS.length) showTab(TABS[newIndex]); }; const generatePDF = () => { const { jsPDF } = window.jspdf; const pdfContent = document.getElementById('pdf-content'); const pdfBtnContainer = document.getElementById('pdf-button-container'); if (!pdfContent || !pdfBtnContainer) return; pdfBtnContainer.style.display = 'none'; html2canvas(pdfContent, { scale: 2, useCORS: true }).then(canvas => { const imgData = canvas.toDataURL('image/png'); const pdf = new jsPDF({ orientation: 'p', unit: 'mm', format: 'a4' }); const pdfWidth = pdf.internal.pageSize.getWidth(); const imgWidth = pdfWidth - 20; const imgHeight = (canvas.height * imgWidth) / canvas.width; pdf.setFontSize(22); pdf.setFont('helvetica', 'bold'); pdf.text('Product Listing Optimization Report', pdfWidth / 2, 15, { align: 'center' }); pdf.addImage(imgData, 'PNG', 10, 25, imgWidth, imgHeight); pdf.save('product-listing-report.pdf'); pdfBtnContainer.style.display = 'block'; }).catch(err => { console.error("Error generating PDF:", err); pdfBtnContainer.style.display = 'block'; }); }; // --- ATTACH LISTENERS --- Object.keys(tabButtons).forEach(key => tabButtons[key].addEventListener('click', () => showTab(key))); prevBtn.addEventListener('click', () => handleNavClick('prev')); nextBtn.addEventListener('click', () => handleNavClick('next')); downloadPdfBtn.addEventListener('click', generatePDF); // --- INITIAL SETUP --- showTab('input'); });
Scroll to Top