Analytics & Revenue Tracking
Dashboard stats
The Analytics tab shows impressions, clicks, CTR, unique IPs, estimated revenue, a daily bar chart, a per-ad breakdown table, and a by-section table.
Impressions are tracked via IntersectionObserver (50% threshold). Clicks are server-side redirects through /oads-click/{id}/.
Revenue tracking
Set CPM and/or CPC rates per ad:
- CPM Rate ($ per 1,000 impressions):
revenue += (impressions / 1000) × cpm_rate - CPC Rate ($ per click):
revenue += clicks × cpc_rate
Time periods
| Key | Range |
|---|---|
7d | Last 7 days |
30d | Last 30 days |
90d | Last 90 days |
all | Since 2020-01-01 |
OAds_Tracker PHP API
phpOAds_Tracker::record_impression( int $ad_id, string $page_url, string $section ): void
OAds_Tracker::record_click( int $ad_id ): void
OAds_Tracker::get_ad_stats( int $ad_id, string $period ): array
// Returns: [ impressions, clicks, ctr, revenue ]
OAds_Tracker::get_overview_stats( string $period ): array
OAds_Tracker::get_recent_log( int $limit, string $type ): array
OAds_Tracker::export_csv( string $type, string $period ): never
CSV export
AJAX action: oads_export_csv — parameters: type (impressions|clicks), period (7d|30d|90d|all).
