383 lines
19 KiB
HTML
383 lines
19 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="UTF-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
<title>论坛埋点周报 - 后台</title>
|
||
<link rel="stylesheet" href="/static/css/style.css">
|
||
<link rel="stylesheet" href="/static/css/admin.css">
|
||
</head>
|
||
<body class="admin-page">
|
||
<header class="admin-header">
|
||
<h1>论坛埋点周报</h1>
|
||
<nav>
|
||
<a href="{{ url_for('admin_forum_tracking_weekly') }}">埋点周报</a>
|
||
<a href="{{ url_for('admin_forum_tracking_daily') }}">埋点日报</a>
|
||
<a href="{{ url_for('admin_forum_tracking') }}">埋点看板</a>
|
||
<a href="{{ url_for('admin_forum_posts') }}">帖子管理</a>
|
||
<a href="{{ url_for('admin_dashboard') }}">返回总览</a>
|
||
<a href="{{ url_for('admin_logout') }}">退出</a>
|
||
</nav>
|
||
</header>
|
||
<main class="admin-main">
|
||
{% if msg %}
|
||
<p class="hint success-msg">{{ msg }}</p>
|
||
{% endif %}
|
||
{% if error %}
|
||
<p class="error-msg">{{ error }}</p>
|
||
{% endif %}
|
||
|
||
<section class="dashboard-section">
|
||
<div class="admin-topline">
|
||
<h2>周报筛选</h2>
|
||
</div>
|
||
<form method="get" class="admin-filter-form">
|
||
<div class="filter-row">
|
||
<div class="filter-item">
|
||
<label for="day">结束日期</label>
|
||
<input id="day" name="day" type="date" value="{{ end_day.isoformat() if end_day else '' }}">
|
||
</div>
|
||
<div class="filter-item">
|
||
<label for="days">窗口天数</label>
|
||
<select id="days" name="days">
|
||
{% for opt in days_options %}
|
||
<option value="{{ opt }}" {{ 'selected' if days == opt else '' }}>最近 {{ opt }} 天</option>
|
||
{% endfor %}
|
||
</select>
|
||
</div>
|
||
<div class="filter-item">
|
||
<label for="variant">CTA 变体</label>
|
||
<select id="variant" name="variant">
|
||
{% for opt in variant_options %}
|
||
<option value="{{ opt }}" {{ 'selected' if selected_variant == opt else '' }}>{{ opt }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
</div>
|
||
<div class="filter-item">
|
||
<label for="device">设备类型</label>
|
||
<select id="device" name="device">
|
||
{% for opt in device_options %}
|
||
<option value="{{ opt }}" {{ 'selected' if selected_device == opt else '' }}>{{ opt }}</option>
|
||
{% endfor %}
|
||
</select>
|
||
</div>
|
||
<div class="filter-actions">
|
||
<button type="submit">查看周报</button>
|
||
<a href="{{ url_for('admin_forum_tracking_weekly') }}">重置</a>
|
||
</div>
|
||
</div>
|
||
</form>
|
||
<div class="tracking-export-row">
|
||
<a href="{{ url_for('admin_forum_tracking_weekly_export_markdown', day=end_day.isoformat() if end_day else '', days=days, variant=selected_variant, device=selected_device) }}" class="admin-btn-link">导出周报 Markdown</a>
|
||
<a href="{{ url_for('admin_forum_tracking_export', mode='variant_funnel', days=days, variant=selected_variant, device=selected_device) }}" class="admin-btn-link">导出变体漏斗 CSV</a>
|
||
<a href="{{ url_for('admin_forum_tracking_export', mode='device_variants', days=days, variant=selected_variant, device=selected_device) }}" class="admin-btn-link">导出设备×变体 CSV</a>
|
||
<a href="{{ url_for('admin_forum_tracking_export', mode='posts', days=days, variant=selected_variant, device=selected_device) }}" class="admin-btn-link">导出帖子转化 CSV</a>
|
||
<a href="{{ url_for('admin_forum_tracking_daily', day=end_day.isoformat() if end_day else '', variant=selected_variant, device=selected_device) }}" class="admin-btn-link">查看结束日日报</a>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>核心指标({{ range_start_day }} ~ {{ range_end_day }})</h2>
|
||
<p class="admin-note">对比窗口:{{ prev_start_day }} ~ {{ prev_end_day }}({{ days }} 天)</p>
|
||
<div class="metric-grid">
|
||
<article class="metric-card">
|
||
<span class="metric-label">曝光</span>
|
||
<strong class="metric-value">{{ summary.impressions }}</strong>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">移动底栏曝光</span>
|
||
<strong class="metric-value">{{ summary.mobile_bar_impressions }}</strong>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">移动比价点击</span>
|
||
<strong class="metric-value">{{ summary.mobile_pricing_clicks }}</strong>
|
||
<small class="metric-meta">Rate {{ summary_rates.mobile_pricing_rate }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">比价点击</span>
|
||
<strong class="metric-value">{{ summary.pricing_clicks }}</strong>
|
||
<small class="metric-meta">CTR {{ summary_rates.pricing_ctr }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">发需求点击</span>
|
||
<strong class="metric-value">{{ summary.new_topic_clicks }}</strong>
|
||
<small class="metric-meta">Rate {{ summary_rates.new_topic_rate }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">模板发帖点击</span>
|
||
<strong class="metric-value">{{ summary.template_clicks }}</strong>
|
||
<small class="metric-meta">Rate {{ summary_rates.template_rate }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">模板发帖提交</span>
|
||
<strong class="metric-value">{{ summary.template_submits }}</strong>
|
||
<small class="metric-meta">Submit {{ summary_rates.template_submit_rate }}% · Completion {{ summary_rates.template_completion_rate }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">评论提交</span>
|
||
<strong class="metric-value">{{ summary.comment_submits }}</strong>
|
||
<small class="metric-meta">Rate {{ summary_rates.comment_rate }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">复制成功</span>
|
||
<strong class="metric-value">{{ summary.copy_success }}</strong>
|
||
<small class="metric-meta">Rate {{ summary_rates.copy_rate }}%</small>
|
||
</article>
|
||
<article class="metric-card">
|
||
<span class="metric-label">总事件</span>
|
||
<strong class="metric-value">{{ summary.events }}</strong>
|
||
</article>
|
||
</div>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>环比变化(上一窗口)</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>指标</th>
|
||
<th>当前窗口</th>
|
||
<th>上一窗口</th>
|
||
<th>变化值</th>
|
||
<th>变化率</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in delta_rows %}
|
||
<tr>
|
||
<td>{{ row.label }}</td>
|
||
<td>{{ row.current }}</td>
|
||
<td>{{ row.previous }}</td>
|
||
<td><span class="delta-pill delta-{{ row.direction }}">{{ '+' if row.delta > 0 else '' }}{{ row.delta }}</span></td>
|
||
<td>{{ '+' if row.delta_pct > 0 else '' }}{{ row.delta_pct }}%</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="5">暂无环比数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>变体漏斗({{ range_start_day }} ~ {{ range_end_day }})</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>变体</th>
|
||
<th>曝光</th>
|
||
<th>比价点击</th>
|
||
<th>CTR</th>
|
||
<th>发需求点击</th>
|
||
<th>需求率</th>
|
||
<th>模板发帖点击</th>
|
||
<th>模板率</th>
|
||
<th>模板发帖提交</th>
|
||
<th>模板完成率</th>
|
||
<th>评论提交</th>
|
||
<th>评论率</th>
|
||
<th>复制成功</th>
|
||
<th>复制率</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in variant_rows %}
|
||
<tr>
|
||
<td><span class="status-pill {{ 'active' if row.variant in ['control', 'intent'] else 'inactive' }}">{{ row.variant }}</span></td>
|
||
<td>{{ row.impressions }}</td>
|
||
<td>{{ row.pricing_clicks }}</td>
|
||
<td>{{ row.pricing_ctr }}%</td>
|
||
<td>{{ row.new_topic_clicks }}</td>
|
||
<td>{{ row.new_topic_rate }}%</td>
|
||
<td>{{ row.template_clicks }}</td>
|
||
<td>{{ row.template_rate }}%</td>
|
||
<td>{{ row.template_submits }}</td>
|
||
<td>{{ row.template_completion_rate }}%</td>
|
||
<td>{{ row.comment_submits }}</td>
|
||
<td>{{ row.comment_rate }}%</td>
|
||
<td>{{ row.copy_success }}</td>
|
||
<td>{{ row.copy_rate }}%</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="14">暂无变体漏斗数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>设备漏斗({{ range_start_day }} ~ {{ range_end_day }})</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>设备</th>
|
||
<th>曝光</th>
|
||
<th>移动底栏曝光</th>
|
||
<th>比价点击</th>
|
||
<th>CTR</th>
|
||
<th>移动比价点击</th>
|
||
<th>移动底栏点击率</th>
|
||
<th>模板发帖点击</th>
|
||
<th>模板发帖提交</th>
|
||
<th>模板完成率</th>
|
||
<th>评论提交</th>
|
||
<th>评论率</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in device_rows %}
|
||
<tr>
|
||
<td><span class="status-pill {{ 'active' if row.device_type in ['mobile', 'desktop', 'tablet'] else 'inactive' }}">{{ row.device_type }}</span></td>
|
||
<td>{{ row.impressions }}</td>
|
||
<td>{{ row.mobile_bar_impressions }}</td>
|
||
<td>{{ row.pricing_clicks }}</td>
|
||
<td>{{ row.pricing_ctr }}%</td>
|
||
<td>{{ row.mobile_pricing_clicks }}</td>
|
||
<td>{{ row.mobile_pricing_rate }}%</td>
|
||
<td>{{ row.template_clicks }}</td>
|
||
<td>{{ row.template_submits }}</td>
|
||
<td>{{ row.template_completion_rate }}%</td>
|
||
<td>{{ row.comment_submits }}</td>
|
||
<td>{{ row.comment_rate }}%</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="12">暂无设备漏斗数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>设备 × 变体漏斗矩阵({{ range_start_day }} ~ {{ range_end_day }})</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>设备</th>
|
||
<th>变体</th>
|
||
<th>曝光</th>
|
||
<th>比价点击</th>
|
||
<th>CTR</th>
|
||
<th>移动比价点击</th>
|
||
<th>移动底栏点击率</th>
|
||
<th>模板发帖点击</th>
|
||
<th>模板发帖提交</th>
|
||
<th>模板完成率</th>
|
||
<th>评论提交</th>
|
||
<th>评论率</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in device_variant_rows %}
|
||
<tr>
|
||
<td><span class="status-pill {{ 'active' if row.device_type in ['mobile', 'desktop', 'tablet'] else 'inactive' }}">{{ row.device_type }}</span></td>
|
||
<td><span class="status-pill {{ 'active' if row.variant in ['control', 'intent'] else 'inactive' }}">{{ row.variant }}</span></td>
|
||
<td>{{ row.impressions }}</td>
|
||
<td>{{ row.pricing_clicks }}</td>
|
||
<td>{{ row.pricing_ctr }}%</td>
|
||
<td>{{ row.mobile_pricing_clicks }}</td>
|
||
<td>{{ row.mobile_pricing_rate }}%</td>
|
||
<td>{{ row.template_clicks }}</td>
|
||
<td>{{ row.template_submits }}</td>
|
||
<td>{{ row.template_completion_rate }}%</td>
|
||
<td>{{ row.comment_submits }}</td>
|
||
<td>{{ row.comment_rate }}%</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="12">暂无设备×变体漏斗数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>Top 比价转化帖子</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>帖子</th>
|
||
<th>曝光</th>
|
||
<th>比价点击</th>
|
||
<th>CTR</th>
|
||
<th>模板点击</th>
|
||
<th>模板提交</th>
|
||
<th>模板完成率</th>
|
||
<th>评论提交</th>
|
||
<th>评论率</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in top_posts %}
|
||
<tr>
|
||
<td><a href="{{ url_for('forum_post_detail', post_id=row.post_id) }}" target="_blank" rel="noopener">#{{ row.post_id }} {{ row.title }}</a></td>
|
||
<td>{{ row.impressions }}</td>
|
||
<td>{{ row.pricing_clicks }}</td>
|
||
<td>{{ row.pricing_ctr }}%</td>
|
||
<td>{{ row.template_clicks }}</td>
|
||
<td>{{ row.template_submits }}</td>
|
||
<td>{{ row.template_completion_rate }}%</td>
|
||
<td>{{ row.comment_submits }}</td>
|
||
<td>{{ row.comment_rate }}%</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="9">暂无帖子周报数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>Top 模板转化帖子</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>帖子</th>
|
||
<th>模板点击</th>
|
||
<th>模板提交</th>
|
||
<th>模板完成率</th>
|
||
<th>模板点击率</th>
|
||
<th>模板提交率</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in template_top_posts %}
|
||
<tr>
|
||
<td><a href="{{ url_for('forum_post_detail', post_id=row.post_id) }}" target="_blank" rel="noopener">#{{ row.post_id }} {{ row.title }}</a></td>
|
||
<td>{{ row.template_clicks }}</td>
|
||
<td>{{ row.template_submits }}</td>
|
||
<td>{{ row.template_completion_rate }}%</td>
|
||
<td>{{ row.template_rate }}%</td>
|
||
<td>{{ row.template_submit_rate }}%</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="6">暂无模板转化帖子数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
|
||
<section class="dashboard-section">
|
||
<h2>Top 标签({{ range_start_day }} ~ {{ range_end_day }})</h2>
|
||
<table class="admin-table">
|
||
<thead>
|
||
<tr>
|
||
<th>事件</th>
|
||
<th>标签</th>
|
||
<th>次数</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
{% for row in top_labels %}
|
||
<tr>
|
||
<td><code>{{ row.event_name }}</code></td>
|
||
<td>{{ row.label }}</td>
|
||
<td>{{ row.total }}</td>
|
||
</tr>
|
||
{% else %}
|
||
<tr><td colspan="3">暂无标签周报数据。</td></tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
</main>
|
||
</body>
|
||
</html>
|