diff --git a/make_post_sell/templates/analytics.j2 b/make_post_sell/templates/analytics.j2 index a5ec475..d93f8cc 100644 --- a/make_post_sell/templates/analytics.j2 +++ b/make_post_sell/templates/analytics.j2 @@ -29,8 +29,8 @@ Avg Session
- {{ overview.avg_ring_depth }} - Avg Ring Depth + {{ overview.avg_ring_consumed }} + Avg Ring Consumed
{{ overview.top_source }} diff --git a/make_post_sell/views/analytics.py b/make_post_sell/views/analytics.py index 444f562..68fe1ec 100644 --- a/make_post_sell/views/analytics.py +++ b/make_post_sell/views/analytics.py @@ -96,7 +96,8 @@ def shop_analytics(request): func.avg(PageSession.wall_clock_ms).label("avg_session_ms"), ).filter(_view_filter(cutoff_7d)).one() - avg_ring_depth = db.query(func.avg(PageSession.ring_position)).filter( + ring_size = len(shop.discovery_ring) or 1 + avg_ring_pct = db.query(func.avg(PageSession.ring_position)).filter( PageSession.shop_id == shop.id, PageSession.ring_position.isnot(None), PageSession.created_timestamp > cutoff_7d, @@ -123,7 +124,7 @@ def shop_analytics(request): "total_views": ov.total_views or 0, "unique_products": ov.unique_products or 0, "avg_session": _fmt_ms(ov.avg_session_ms), - "avg_ring_depth": f"{avg_ring_depth:.1f}" if avg_ring_depth else "\u2014", + "avg_ring_consumed": _fmt_pct(avg_ring_pct / ring_size) if avg_ring_pct else "\u2014", "top_source": REFERRER_LABELS.get(top_src[0], "\u2014") if top_src else "\u2014", "device_split": dev_split_str, }