Spaces:
Running
Running
Can you seperate this data into 2 blocks?: Detailed Performance Data
Browse filesLocation Metric October Baseline Current (Nov-Dec) Trend
Chadwell Avg CPC 3.47 1.80 Improved
Chadwell Cost per Conversion 3.42 Lower or Stable Improved
Ellicott City ER Avg CPC 1.77 1.80 Stable
Ellicott City ER Cost per Conversion 5.81 Lower Improved
Bay Beach Avg CPC 3.19 2.79 Improved
Bay Beach Cost per Conversion 7.42 Lower Improved
Beltsville Avg CPC 1.96 2.00 Stable
Dr Dan's Avg CPC 19.92 Much Lower Improved
Hoffman Avg CPC 3.60 3.50 Stable
Mixed Pet Avg CPC 10.43 Lower Improved
Colonial Avg CPC 9.15 Slightly Lower Improved
Jackson Square Avg CPC 6.21 Lower Improved
12 unmodified lines13141516171819202122232425262728293031323334353637383940414212 unmodified lines{ location: 'Colonial', metric: 'Avg CPC', baseline: '9.15', current: 'Slightly Lower', trend: 'Improved' },{ location: 'Jackson Square', metric: 'Avg CPC', baseline: '6.21', current: 'Lower', trend: 'Improved' }];// Populate tableconst tableBody = document.getElementById('data-table');data.forEach(item => {const row = document.createElement('tr');row.className = 'hover:bg-gray-50';const trendClass = item.trend === 'Improved' ? 'trend-improved' :item.trend === 'Stable' ? 'trend-stable' : 'trend-worsened';row.innerHTML = `<td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.location}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.metric}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.baseline}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.current}</td><td class="px-6 py-4 whitespace-nowrap text-sm ${trendClass} font-semibold"><i data-feather="${item.trend === 'Improved' ? 'trending-up' : item.trend === 'Stable' ? 'minus' : 'trending-down'}" class="inline mr-1"></i>${item.trend}</td>`;tableBody.appendChild(row);});// Create summary cardsconst cardsContainer = document.querySelector('.grid');// Avg CPC Summary12 unmodified lines13141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010112 unmodified lines{ location: 'Colonial', metric: 'Avg CPC', baseline: '9.15', current: 'Slightly Lower', trend: 'Improved' },{ location: 'Jackson Square', metric: 'Avg CPC', baseline: '6.21', current: 'Lower', trend: 'Improved' }];// Create two tables - one for CPC and one for Conversion metricsconst cpcData = data.filter(item => item.metric === 'Avg CPC');const conversionData = data.filter(item => item.metric === 'Cost per Conversion');// Create CPC tableconst cpcTable = document.createElement('div');cpcTable.className = 'mt-8 bg-white rounded-xl shadow-md overflow-hidden';cpcTable.innerHTML = `<div class="px-6 py-4 border-b border-gray-200"><h2 class="text-xl font-semibold text-gray-800">CPC Performance</h2></div><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50"><tr><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Location</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">October Baseline</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Current (Nov-Dec)</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Trend</th></tr></thead><tbody class="bg-white divide-y divide-gray-200" id="cpc-table">${cpcData.map(item => `<tr class="hover:bg-gray-50"><td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.location}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.baseline}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.current}</td><td class="px-6 py-4 whitespace-nowrap text-sm ${item.trend === 'Improved' ? 'trend-improved' : item.trend === 'Stable' ? 'trend-stable' : 'trend-worsened'} font-semibold"><i data-feather="${item.trend === 'Improved' ? 'trending-up' : item.trend === 'Stable' ? 'minus' : 'trending-down'}" class="inline mr-1"></i>${item.trend}</td></tr>`).join('')}</tbody></table></div>`;// Create Conversion tableconst conversionTable = document.createElement('div');conversionTable.className = 'mt-8 bg-white rounded-xl shadow-md overflow-hidden';conversionTable.innerHTML = `<div class="px-6 py-4 border-b border-gray-200"><h2 class="text-xl font-semibold text-gray-800">Conversion Performance</h2></div><div class="overflow-x-auto"><table class="min-w-full divide-y divide-gray-200"><thead class="bg-gray-50"><tr><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Location</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">October Baseline</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Current (Nov-Dec)</th><th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Trend</th></tr></thead><tbody class="bg-white divide-y divide-gray-200" id="conversion-table">${conversionData.map(item => `<tr class="hover:bg-gray-50"><td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900">${item.location}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.baseline}</td><td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${item.current}</td><td class="px-6 py-4 whitespace-nowrap text-sm ${item.trend === 'Improved' ? 'trend-improved' : item.trend === 'Stable' ? 'trend-stable' : 'trend-worsened'} font-semibold"><i data-feather="${item.trend === 'Improved' ? 'trending-up' : item.trend === 'Stable' ? 'minus' : 'trending-down'}" class="inline mr-1"></i>${item.trend}</td></tr>`).join('')}</tbody></table></div>`;// Remove the original table containerconst originalTable = document.querySelector('.mt-12.bg-white.rounded-xl.shadow-md.overflow-hidden');if (originalTable) {originalTable.remove();}// Insert the new tablesconst main = document.querySelector('main');main.insertBefore(cpcTable, document.querySelector('.mt-12'));main.insertBefore(conversionTable, document.querySelector('.mt-12'));// Create summary cardsconst cardsContainer = document.querySelector('.grid');// Avg CPC Summary
script.js+81-22