Repository navigation
Conversation
sfsmfc
force-pushed
the
feature/analytics-data-client-utility
branch
2 times, most recently
from
October 14, 2026 09:27
bac87bc to
5365e01
Compare
sfsmfc
force-pushed
the
feature/analytics-data-client-utility
branch
from
October 14, 2026 09:31
5365e01 to
ec94e3c
Compare
sfsmfc
force-pushed
the
feature/analytics-data-client-utility
branch
from
November 6, 2026 10:04
ec94e3c to
681aebe
Compare
sfsmfc
force-pushed
the
feature/analytics-data-client-utility
branch
from
November 16, 2026 10:23
681aebe to
e2fb62d
Compare
…ilities The data client only builds and sends the requests now. The helpers without a dependency go into two utility classes with own tests: - AnalyticsQueryUtility: UTC day ranges, graph queries and the page URL filter - AnalyticsResponseUtility: settled responses, session totals, daily series, time on page and time series The behaviour does not change.
Each fetch method built the headers, sent the request, decoded the JSON and converted the errors by itself. postJson() now does these steps once, websiteUrl() builds the URL below a website and fetchGraph() fetches a daily graph. The visits, sessions and visitors graphs share fetchGraph(). AnalyticsResponseUtility::graph() reads the labels and datasets of a graph response. timeSeriesData() takes the decoded body. The behaviour does not change.
…ll UTC days The analytics and graph endpoints bucket by UTC day. These widgets still sent the range with the local offset, so the first day of the range was only a part of a day. All queries of the data client now use full UTC days, as the site performance widget and the page performance bar already do. The previous period of the top pages and the session breakdowns uses the same range. The numbers of the three widgets can change a little, because the first day is now complete.
PagePerformanceBarBuilder loaded the data of the bar and built its HTML as strings, with manual escaping. The class is split: - PagePerformanceDataProvider gets the site, the page URL, the link to the dashboard and the metrics. A metric holds label keys instead of translated labels. - PagePerformanceBarRenderer renders the templates Skeleton.html and Bar.html in Resources/Private/Templates/PagePerformance and the partial PagePerformance/MetricDetails.html. The sparkline comes from the sparkline ViewHelper. The renderer gives the request to the views, so the view helpers get the language of the backend user. Fluid escapes all output now. The HTML of the bar does not change, so the styles and the JavaScript of the bar stay as they are. A functional test renders the templates with a real backend user. A second functional test sends the bar through the AJAX route with the metrics from the API and replaces only the HTTP transport.
andreaskienast
force-pushed
the
feature/analytics-data-client-utility
branch
from
November 24, 2026 11:44
e2fb62d to
ef68f9a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactoring of the data client and the page performance bar. Stacked on #29.
Data client
AnalyticsQueryUtilityandAnalyticsResponseUtilitywith own tests. The behaviour does not change.postJson().websiteUrl()builds the URLs,fetchGraph()fetches the daily graphs. The behaviour does not change.Page performance bar
PagePerformanceBarBuilderis split intoPagePerformanceDataProvider(site, page URL, link and metrics) andPagePerformanceBarRenderer.Resources/Private/Templates/PagePerformanceand the partialPagePerformance/MetricDetails.html. Fluid escapes all output. The manual escaping is removed.Test
ddev composer t3g:test,t3g:test:functional,t3g:phpstanandt3g:cglpass.