fix(v83-kpi): landing_page_conversion status ternary now compares value vs target 3pct - fix WARN when val >= target - 24 WARN to 23 WARN
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
Some checks failed
WEVAL NonReg / nonreg (push) Has been cancelled
This commit is contained in:
@@ -152,7 +152,7 @@ $kpis = [
|
||||
["id" => "email_deliverability", "label" => "Email deliverability", "value" => (function(){$s=intval(trim(@shell_exec("tail -10000 /var/log/pmta/accounting.log 2>/dev/null | grep -c d 2>/dev/null || echo 0"))); $t=intval(trim(@shell_exec("tail -10000 /var/log/pmta/accounting.log 2>/dev/null | wc -l"))); return $t>0?round($s/$t*100,1):95; })(), "unit" => "%", "target" => 95, "trend" => "wire_wevads", "status" => "live", "source" => "WEVADS", "drill" => "Delivered / Sent"],
|
||||
["id" => "open_rate", "label" => "Email open rate", "value" => (function(){$b=@json_decode(@file_get_contents("http://127.0.0.1/api/v83-bridge-internal.php"),true); return $b["kpis"]["open_rate"]["value"]??8; })(), "unit" => "%", "target" => 25, "trend" => "bridge_internal", "status" => (function(){$b=@json_decode(@file_get_contents("http://127.0.0.1/api/v83-bridge-internal.php"),true); $v=$b["kpis"]["open_rate"]["value"]??0; return $v>=25?"ok":($v>0?"warn":"wire_needed"); })(), "source" => "v83-bridge-internal (canonical)", "drill" => "Opens / Delivered from WEVADS pixels"],
|
||||
["id" => "click_through_rate", "label" => "CTR (Click-through)", "value" => (function(){$clicks=intval(trim(@shell_exec("grep -c \"action=hit\" /var/log/nginx/access.log 2>/dev/null"))); $opens=$clicks; return $opens>0?5.0:0; })(), "unit" => "%", "target" => 5, "trend" => "wire_wevads", "status" => "live", "source" => "Click tracking", "drill" => "Clicks / Opens"],
|
||||
["id" => "landing_page_conversion", "label" => "Landing conversion", "value" => (function(){$q=urlencode('SELECT uniqExact(user_id) FROM plausible_events.events_v2 WHERE hostname=\'weval-consulting.com\' AND timestamp >= now() - INTERVAL 30 DAY FORMAT CSV'); $vs=intval(trim(@file_get_contents("http://127.0.0.1:8123/?query=$q"))); $tr=@json_decode(@file_get_contents("http://localhost/api/v85-demo-tracker.php"),true); $leads=$tr["month_hits_total"]??0; return $vs>0?min(100,round($leads/$vs*100,2)):0; })(), "unit" => "%", "target" => 3, "trend" => "plausible_clickhouse", "status" => (function(){$q=urlencode('SELECT uniqExact(user_id) FROM plausible_events.events_v2 WHERE hostname=\'weval-consulting.com\' AND timestamp >= now() - INTERVAL 30 DAY FORMAT CSV'); $vs=intval(trim(@file_get_contents("http://127.0.0.1:8123/?query=$q"))); return $vs>0?"warn":"wire_needed"; })(), "source" => "Plausible ClickHouse (real)", "drill" => "Leads / Unique Visitors last 30d"],
|
||||
["id" => "landing_page_conversion", "label" => "Landing conversion", "value" => (function(){$q=urlencode('SELECT uniqExact(user_id) FROM plausible_events.events_v2 WHERE hostname=\'weval-consulting.com\' AND timestamp >= now() - INTERVAL 30 DAY FORMAT CSV'); $vs=intval(trim(@file_get_contents("http://127.0.0.1:8123/?query=$q"))); $tr=@json_decode(@file_get_contents("http://localhost/api/v85-demo-tracker.php"),true); $leads=$tr["month_hits_total"]??0; return $vs>0?min(100,round($leads/$vs*100,2)):0; })(), "unit" => "%", "target" => 3, "trend" => "plausible_clickhouse", "status" => (function(){$q=urlencode('SELECT uniqExact(user_id) FROM plausible_events.events_v2 WHERE hostname=\'weval-consulting.com\' AND timestamp >= now() - INTERVAL 30 DAY FORMAT CSV'); $vs=intval(trim(@file_get_contents("http://127.0.0.1:8123/?query=$q"))); $tr=@json_decode(@file_get_contents("http://localhost/api/v85-demo-tracker.php"),true); $leads=$tr["month_hits_total"]??0; $conv=$vs>0?min(100,round($leads/$vs*100,2)):0; return $conv >= 3 ? "ok" : ($conv > 0 ? "warn" : "wire_needed"); })(), "source" => "Plausible ClickHouse (real)", "drill" => "Leads / Unique Visitors last 30d"],
|
||||
["id" => "marketing_qualified_leads", "label" => "MQLs this week", "value" => $v50["mqls_week"], "unit" => "leads", "target" => 50, "trend" => "live", "status" => $v50["mqls_week"] >= 50 ? "ok" : "warn", "source" => "CRM scoring", "drill" => "Lead scoring > threshold"],
|
||||
["id" => "sales_qualified_leads", "label" => "SQLs this week", "value" => $v50["sqls_week"], "unit" => "leads", "target" => 10, "trend" => "live", "status" => $v50["sqls_week"] >= 10 ? "ok" : "warn", "source" => "CRM qualified", "drill" => "BANT qualified"]
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user