Campaign metrics read visitors and avg_engaged, which sort=views responses omit
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 72/100
Direzione di ricerca
Inizia da src/rest-api/stats/class-endpoint-posts.php, in particolare da Endpoint_Posts::fetch_campaign_data() intorno alle righe 510–513, e confronta la gestione delle metriche con le richieste Post List Stats e Smart Linking menzionate nella issue. Riproduci la richiesta senza sort ed esamina la risposta della campagna. Il lavoro è completo quando l'endpoint evita gli avvisi relativi a chiavi non definite e restituisce le metriche della campagna fornite dall'API.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
Endpoint_Posts::fetch_campaign_data() copies four metrics from the campaign response without checking that they exist (src/rest-api/stats/class-endpoint-posts.php:510–:513). The Parse.ly API returns different metrics depending on sort: with sort=views, metrics holds only views and recirculation_rate, while visitors and avg_engaged need sort=avg_engaged. The plugin already works around this elsewhere, as Post List Stats and Smart Linking request sort=avg_engaged for that reason.
The Engagement Boost dashboard sends no sort, so the endpoint falls back to views for both the main and the campaign request. Reading visitors and avg_engaged then raises a warning for each post with campaign data, and the response never includes campaign.visitors or campaign.avgEngaged.
To Reproduce
- Request
GET /wp-parsely/v2/stats/posts?campaign_id=wp-parsely&campaign_medium=smart-link&period_start=30dwithoutsort, as the Engagement Boost dashboard does. - Check the PHP error log.
PHP raises Undefined array key "visitors" at class-endpoint-posts.php:511 and Undefined array key "avg_engaged" at :513 for each post with campaign data. Each campaign object holds only views and recirculationRate.
Expected behavior
No warnings, and a campaign object that holds the metrics the API returned.
Environment
wp-parsely 3.26.1 and current develop, PHP 8.3. Confirmed against the live Parse.ly API: a sort=views request with these campaign parameters returns only views and recirculation_rate.
Additional context
The dashboard only reads campaign.views, so the visible effect today is the log noise. Possible fixes: copy only the metrics present, and request sort=avg_engaged for the campaign data if visitors and avg_engaged are needed.
Related: #4854, which affects the same block.
- Lingua principale
- PHP
- Stelle
- 67
- Fork
- 38
- Merge medio
- 1g 5h
- PR unite (30g)
- 79
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Parsely/wp-parsely
-
Bug Feature: Engagement Boost wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Parsely/wp-parsely#4856 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Feature: Engagement Boost wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Parsely/wp-parsely#4854 ·
I maintainer di solito rispondono entro 1 giorno
-
wp-parsely
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Parsely/wp-parsely#4753 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug wp-parsely
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
Parsely/wp-parsely#4663 ·
I maintainer di solito rispondono entro 1 giorno
-
Documentation wp-parsely
Difficoltà 3/5 1-2 giorni Idoneità per principianti 74/100
Parsely/wp-parsely#4559 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Parsely/wp-parsely
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
parime/glpi-iso27001-management#1165 ·
I maintainer di solito rispondono entro 1 giorno
-
15.0
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
opnsense/plugins#5976 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
open-telemetry/opentelemetry-php-distro#176 ·
I maintainer di solito rispondono entro 2 giorni