get_total_generations(); $generations_30_days = $analytics_service->get_generations_last_30_days(); $success_rate = $analytics_service->get_success_rate(); $daily_counts = $analytics_service->get_daily_counts_30_days(); $template_breakdown = $analytics_service->get_template_breakdown(); $recent_activity = $analytics_service->get_recent_activity( 20 ); $export_activity = $analytics_service->get_recent_activity(1000); // Calculate daily average $daily_avg = count( $daily_counts ) ? round( array_sum( $daily_counts ) / count( $daily_counts ), 1 ) : 0; // Chart Analytics Logic $actual_max = ! empty( $daily_counts ) ? max( $daily_counts ) : 0; // Force a minimum Y-axis ceiling of 10 so small numbers don't stretch to 100% height $y_max = max( $actual_max, 10 ); // Round up to the nearest multiple of 10 for clean grid lines if the number is large if ( $y_max > 10 ) { $y_max = ceil( $y_max / 10 ) * 10; } // Register the downloadAnalyticsCSV function via WP enqueue system. $export_data_json = wp_json_encode( $export_activity ); $analytics_inline_js = " function downloadAnalyticsCSV() { var rawData = {$export_data_json}; if (!rawData || rawData.length === 0) { alert('No analytics data available to export yet.'); return; } var csvString = 'Date & Time,Template Name,Template ID,Status\\n'; rawData.forEach(function(row) { var date = '\"' + row.created_at + '\"'; var name = '\"' + (row.template_name ? row.template_name.replace(/\"/g, '\"\"') : 'Unknown') + '\"'; var id = '\"' + row.template_id + '\"'; var status = '\"' + row.status.toUpperCase() + '\"'; csvString += date + ',' + name + ',' + id + ',' + status + '\\n'; }); var blob = new Blob(['\\ufeff' + csvString], { type: 'text/csv;charset=utf-8;' }); var url = URL.createObjectURL(blob); var link = document.createElement('a'); link.href = url; var today = new Date().toISOString().split('T')[0]; link.setAttribute('download', '100prints-analytics-' + today + '.csv'); link.style.visibility = 'hidden'; document.body.appendChild(link); link.click(); document.body.removeChild(link); } "; wp_add_inline_script( '100prints-admin-js', $analytics_inline_js ); ?>
'Analytics' ]; require HUNDRED_PRINTS_PATH . 'admin/partials/header.php'; ?>

Total Vol.

30-Day Trend

Success Rate

%

Daily Avg

Awaiting Data

Analytics will populate automatically once visitors begin generating documents from your blocks.

Generation Volume

Rolling 30-day activity.

0
$count ) : $height_percent = ( $count / $y_max ) * 100; $day = date( 'd', strtotime( $date ) ); // Only show every 3rd date label to prevent crowding on small screens, but always show the first and last $show_label = ($day_counter % 3 === 0 || $day_counter === 0 || $day_counter === count($daily_counts) - 1); ?>

Template Performance

Template ID Total Hits Last Active
template_name ); ?> count ) ); ?> last_used ), current_time( 'timestamp' ) ) . ' ago' ); ?>

No template data available.

Live Event Log

Timestamp Resource Status
created_at ) ); ?> template_name ); ?> status === 'success' ) : ?> OK ERR

No events logged.