<?php
global $wpdb;
$table_name = $wpdb->prefix . "bpbooster_clicks";

// Obtener clics por tipo
$results = $wpdb->get_results("SELECT button_type, COUNT(*) as total FROM $table_name GROUP BY button_type");

?>
<div class="wrap">
    <h1>📊 Blog Popup Booster - Reporte de Clics</h1>
    <table class="widefat fixed striped">
        <thead>
            <tr>
                <th>Tipo de Botón</th>
                <th>Total de Clics</th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($results as $row): ?>
                <tr>
                    <td><?php echo esc_html(ucfirst($row->button_type)); ?></td>
                    <td><?php echo esc_html($row->total); ?></td>
                </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>
