ArtisanPack UI
DocsAnalytics - GoogleGaTopContentData

GaTopContentData

Analytics - Google v1.1.0

— immutable, readonly DTO backing the top-content surface. - — sorted by descending. - — sorted by descending. - — the same passed to . JSON shape...

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,
)
  • topPages — list<array{path: string, title: string, views: float, users: float}> sorted by views descending.
  • topEvents — list<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 ], ... ],
]

Stay in the Loop

Monthly tips, tutorials and package updates — plus a free Quick Start cheat sheet.

Subscribe
Edit this page on GitHub