Analytics - Google - v1.0.0

GaTopContentData

ArtisanPackUI\AnalyticsGoogle\Reporting\GaTopContentData — immutable, readonly final DTO backing the top-content surface.

Constructor

public function __construct(
    public readonly array $topPages,    // list<{path, title, views, users}>
    public readonly array $topEvents,   // list<{event, count, users}>
    public readonly DateRange $range,
)
  • topPageslist<array{path: string, title: string, views: float, users: float}> sorted by views descending.
  • topEventslist<array{event: string, count: float, users: float}> sorted by count descending.
  • range — the same DateRange passed to GaTopContentFetcher::fetch().

Methods

toArray(): array<string, mixed>

JSON shape returned by the /analytics-google/top-content endpoint:

[
    'range'      => [ 'startDate' => '29daysAgo', 'endDate' => 'today' ],
    'top_pages'  => [ [ 'path' => '/', 'title' => 'Home', 'views' => 1234.0, 'users' => 800.0 ], ... ],
    'top_events' => [ [ 'event' => 'page_view', 'count' => 4567.0, 'users' => 800.0 ], ... ],
]