Spaces:
Running

dashboard1 / index.html
fcofernandes's picture
Add 2 files
3751e5b verified
Raw History Blame Contribute Delete
27.9 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Analytics Dashboard - GA4 Integration</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
.sidebar {
transition: all 0.3s ease;
}
.card-hover:hover {
transform: translateY(-5px);
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.progress-bar {
transition: width 1s ease-in-out;
}
.chart-container {
position: relative;
height: 300px;
}
.dropdown-content {
display: none;
position: absolute;
right: 0;
min-width: 200px;
z-index: 1;
}
.dropdown:hover .dropdown-content {
display: block;
}
</style>
</head>
<body class="bg-gray-50 font-sans">
<div class="flex h-screen overflow-hidden">
<!-- Sidebar -->
<div class="sidebar bg-white w-64 border-r border-gray-200 flex flex-col">
<div class="p-4 border-b border-gray-200">
<div class="flex items-center">
<i class="fas fa-chart-line text-blue-500 text-2xl mr-2"></i>
<span class="text-xl font-semibold">AnalyticsPro</span>
</div>
</div>
<div class="flex-1 overflow-y-auto">
<div class="p-4">
<div class="mb-6">
<h3 class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">Main</h3>
<a href="#" class="flex items-center py-2 px-3 bg-blue-50 text-blue-600 rounded-lg">
<i class="fas fa-home mr-3"></i>
<span>Dashboard</span>
</a>
</div>
<div class="mb-6">
<h3 class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">Reports</h3>
<a href="#" class="flex items-center py-2 px-3 text-gray-700 hover:bg-gray-100 rounded-lg mb-1">
<i class="fas fa-users mr-3"></i>
<span>Audience</span>
</a>
<a href="#" class="flex items-center py-2 px-3 text-gray-700 hover:bg-gray-100 rounded-lg mb-1">
<i class="fas fa-shopping-cart mr-3"></i>
<span>Acquisition</span>
</a>
<a href="#" class="flex items-center py-2 px-3 text-gray-700 hover:bg-gray-100 rounded-lg mb-1">
<i class="fas fa-bolt mr-3"></i>
<span>Behavior</span>
</a>
<a href="#" class="flex items-center py-2 px-3 text-gray-700 hover:bg-gray-100 rounded-lg">
<i class="fas fa-dollar-sign mr-3"></i>
<span>Conversions</span>
</a>
</div>
<div class="mb-6">
<h3 class="text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2">Tools</h3>
<a href="#" class="flex items-center py-2 px-3 text-gray-700 hover:bg-gray-100 rounded-lg mb-1">
<i class="fas fa-cog mr-3"></i>
<span>Admin</span>
</a>
<a href="#" class="flex items-center py-2 px-3 text-gray-700 hover:bg-gray-100 rounded-lg">
<i class="fas fa-plug mr-3"></i>
<span>Integrations</span>
</a>
</div>
</div>
</div>
<div class="p-4 border-t border-gray-200">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white mr-2">
<span>JD</span>
</div>
<div>
<div class="text-sm font-medium">John Doe</div>
<div class="text-xs text-gray-500">Admin</div>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="flex-1 flex flex-col overflow-hidden">
<!-- Top Navigation -->
<header class="bg-white border-b border-gray-200 p-4 flex items-center justify-between">
<div class="flex items-center">
<button class="mr-4 text-gray-500">
<i class="fas fa-bars"></i>
</button>
<h1 class="text-xl font-semibold">Dashboard</h1>
</div>
<div class="flex items-center space-x-4">
<div class="relative">
<button class="p-2 text-gray-500 hover:text-gray-700">
<i class="fas fa-bell"></i>
</button>
<span class="absolute top-0 right-0 w-2 h-2 bg-red-500 rounded-full"></span>
</div>
<div class="relative">
<button class="p-2 text-gray-500 hover:text-gray-700">
<i class="fas fa-envelope"></i>
</button>
<span class="absolute top-0 right-0 w-2 h-2 bg-blue-500 rounded-full"></span>
</div>
<div class="relative dropdown">
<button class="flex items-center space-x-2">
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white">
<span>JD</span>
</div>
<i class="fas fa-chevron-down text-gray-500 text-xs"></i>
</button>
<div class="dropdown-content mt-2 bg-white rounded-md shadow-lg py-1">
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Profile</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Settings</a>
<a href="#" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">Log out</a>
</div>
</div>
</div>
</header>
<!-- Main Content Area -->
<main class="flex-1 overflow-y-auto p-6 bg-gray-50">
<!-- Date Range and Filters -->
<div class="bg-white rounded-lg shadow-sm p-4 mb-6 flex items-center justify-between">
<div class="flex items-center space-x-4">
<div class="relative">
<button class="bg-gray-100 hover:bg-gray-200 px-4 py-2 rounded-lg text-sm font-medium flex items-center">
<span>Last 7 days</span>
<i class="fas fa-chevron-down ml-2 text-xs"></i>
</button>
</div>
<div class="flex items-center space-x-2 text-sm text-gray-500">
<span>Comparing to</span>
<button class="bg-gray-100 hover:bg-gray-200 px-3 py-1 rounded-lg text-sm font-medium">
Previous period
</button>
</div>
</div>
<div>
<button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium flex items-center">
<i class="fas fa-plus mr-2"></i>
<span>Connect GA4 Account</span>
</button>
</div>
</div>
<!-- Summary Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-6">
<div class="bg-white rounded-lg shadow-sm p-6 card-hover transition-all duration-300">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-500">Users</h3>
<i class="fas fa-users text-blue-500"></i>
</div>
<div class="text-2xl font-bold mb-2">12,345</div>
<div class="flex items-center text-sm">
<span class="text-green-500 flex items-center">
<i class="fas fa-arrow-up mr-1"></i> 24.5%
</span>
<span class="text-gray-500 ml-2">vs last period</span>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm p-6 card-hover transition-all duration-300">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-500">New Users</h3>
<i class="fas fa-user-plus text-green-500"></i>
</div>
<div class="text-2xl font-bold mb-2">3,210</div>
<div class="flex items-center text-sm">
<span class="text-green-500 flex items-center">
<i class="fas fa-arrow-up mr-1"></i> 12.3%
</span>
<span class="text-gray-500 ml-2">vs last period</span>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm p-6 card-hover transition-all duration-300">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-500">Sessions</h3>
<i class="fas fa-chart-bar text-purple-500"></i>
</div>
<div class="text-2xl font-bold mb-2">24,678</div>
<div class="flex items-center text-sm">
<span class="text-red-500 flex items-center">
<i class="fas fa-arrow-down mr-1"></i> 8.2%
</span>
<span class="text-gray-500 ml-2">vs last period</span>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm p-6 card-hover transition-all duration-300">
<div class="flex items-center justify-between mb-4">
<h3 class="text-sm font-medium text-gray-500">Bounce Rate</h3>
<i class="fas fa-signal text-yellow-500"></i>
</div>
<div class="text-2xl font-bold mb-2">42.3%</div>
<div class="flex items-center text-sm">
<span class="text-red-500 flex items-center">
<i class="fas fa-arrow-up mr-1"></i> 3.7%
</span>
<span class="text-gray-500 ml-2">vs last period</span>
</div>
</div>
</div>
<!-- Main Charts -->
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 mb-6">
<div class="bg-white rounded-lg shadow-sm p-6 lg:col-span-2">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold">Users Overview</h2>
<div class="flex space-x-2">
<button class="px-3 py-1 text-sm bg-blue-50 text-blue-600 rounded-lg">Users</button>
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200">New Users</button>
<button class="px-3 py-1 text-sm bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200">Sessions</button>
</div>
</div>
<div class="chart-container">
<canvas id="usersChart"></canvas>
</div>
</div>
<div class="bg-white rounded-lg shadow-sm p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold">Traffic Sources</h2>
<button class="text-gray-500 hover:text-gray-700">
<i class="fas fa-ellipsis-h"></i>
</button>
</div>
<div class="chart-container">
<canvas id="trafficChart"></canvas>
</div>
</div>
</div>
<!-- Bottom Section -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<!-- Top Pages -->
<div class="bg-white rounded-lg shadow-sm p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold">Top Pages</h2>
<button class="text-blue-600 text-sm font-medium">View All</button>
</div>
<div class="overflow-x-auto">
<table class="min-w-full divide-y divide-gray-200">
<thead>
<tr>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Page Title</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Views</th>
<th class="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">% Change</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200">
<tr>
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">Homepage</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-500">8,456</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-green-500">+12.5%</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">Product Catalog</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-500">5,234</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-green-500">+8.3%</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">Checkout</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-500">3,789</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-red-500">-2.1%</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">Blog Post</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-500">2,567</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-green-500">+15.7%</td>
</tr>
<tr>
<td class="px-4 py-3 whitespace-nowrap text-sm font-medium text-gray-900">About Us</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-gray-500">1,890</td>
<td class="px-4 py-3 whitespace-nowrap text-sm text-green-500">+5.4%</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- Device Breakdown -->
<div class="bg-white rounded-lg shadow-sm p-6">
<div class="flex items-center justify-between mb-6">
<h2 class="text-lg font-semibold">Device Breakdown</h2>
<button class="text-blue-600 text-sm font-medium">View All</button>
</div>
<div class="space-y-4">
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Desktop</span>
<span class="text-sm font-medium text-gray-700">52%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-blue-600 h-2 rounded-full progress-bar" style="width: 52%"></div>
</div>
</div>
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Mobile</span>
<span class="text-sm font-medium text-gray-700">41%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-green-500 h-2 rounded-full progress-bar" style="width: 41%"></div>
</div>
</div>
<div>
<div class="flex justify-between mb-1">
<span class="text-sm font-medium text-gray-700">Tablet</span>
<span class="text-sm font-medium text-gray-700">7%</span>
</div>
<div class="w-full bg-gray-200 rounded-full h-2">
<div class="bg-purple-500 h-2 rounded-full progress-bar" style="width: 7%"></div>
</div>
</div>
</div>
<div class="mt-6">
<div class="chart-container" style="height: 200px;">
<canvas id="deviceChart"></canvas>
</div>
</div>
</div>
</div>
<!-- GA4 Connection Modal -->
<div id="ga4Modal" class="hidden fixed inset-0 bg-gray-600 bg-opacity-50 flex items-center justify-center z-50">
<div class="bg-white rounded-lg shadow-xl w-full max-w-md">
<div class="p-6">
<div class="flex justify-between items-center mb-4">
<h3 class="text-lg font-semibold">Connect GA4 Account</h3>
<button onclick="closeModal()" class="text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
</div>
<div class="mb-6">
<p class="text-gray-600 mb-4">Connect your Google Analytics 4 property to visualize data in this dashboard.</p>
<div class="flex items-center p-4 border border-gray-200 rounded-lg mb-4">
<i class="fab fa-google text-red-500 text-2xl mr-3"></i>
<div>
<h4 class="font-medium">Google Analytics 4</h4>
<p class="text-sm text-gray-500">Connect with your Google account</p>
</div>
</div>
<div class="p-4 border border-gray-200 rounded-lg">
<h4 class="font-medium mb-2">Property ID</h4>
<input type="text" placeholder="Enter GA4 Property ID" class="w-full px-3 py-2 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500">
<p class="text-xs text-gray-500 mt-2">Find this in your GA4 Admin settings under "Property Settings"</p>
</div>
</div>
<div class="flex justify-end space-x-3">
<button onclick="closeModal()" class="px-4 py-2 border border-gray-300 rounded-lg text-gray-700 hover:bg-gray-50">Cancel</button>
<button class="px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700">Connect Account</button>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
// Initialize charts
document.addEventListener('DOMContentLoaded', function() {
// Users Chart
const usersCtx = document.getElementById('usersChart').getContext('2d');
const usersChart = new Chart(usersCtx, {
type: 'line',
data: {
labels: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul'],
datasets: [
{
label: 'Current Period',
data: [6500, 5900, 8000, 8100, 8600, 10500, 12345],
borderColor: '#3B82F6',
backgroundColor: 'rgba(59, 130, 246, 0.05)',
borderWidth: 2,
fill: true,
tension: 0.4
},
{
label: 'Previous Period',
data: [5000, 4800, 7000, 7500, 8000, 9500, 11000],
borderColor: '#E5E7EB',
backgroundColor: 'transparent',
borderWidth: 2,
borderDash: [5, 5],
tension: 0.4
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
position: 'top',
}
},
scales: {
y: {
beginAtZero: false
}
}
}
});
// Traffic Chart
const trafficCtx = document.getElementById('trafficChart').getContext('2d');
const trafficChart = new Chart(trafficCtx, {
type: 'doughnut',
data: {
labels: ['Organic Search', 'Direct', 'Social', 'Referral', 'Email'],
datasets: [{
data: [45, 25, 15, 10, 5],
backgroundColor: [
'#3B82F6',
'#10B981',
'#F59E0B',
'#8B5CF6',
'#EC4899'
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
cutout: '70%',
plugins: {
legend: {
position: 'right',
}
}
}
});
// Device Chart
const deviceCtx = document.getElementById('deviceChart').getContext('2d');
const deviceChart = new Chart(deviceCtx, {
type: 'bar',
data: {
labels: ['Desktop', 'Mobile', 'Tablet'],
datasets: [{
data: [52, 41, 7],
backgroundColor: [
'#3B82F6',
'#10B981',
'#8B5CF6'
],
borderWidth: 0
}]
},
options: {
responsive: true,
maintainAspectRatio: false,
plugins: {
legend: {
display: false
}
},
scales: {
y: {
beginAtZero: true,
max: 60,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
}
}
});
});
// Modal functions
function openModal() {
document.getElementById('ga4Modal').classList.remove('hidden');
}
function closeModal() {
document.getElementById('ga4Modal').classList.add('hidden');
}
// Simulate GA4 connection button
document.querySelector('main').addEventListener('click', function(e) {
if (e.target.closest('button') && e.target.closest('button').textContent.includes('Connect GA4 Account')) {
openModal();
}
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=fcofernandes/dashboard1" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html>