Analytics and revenue
Dashboard
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 client-side via IntersectionObserver at 50% visibility (so off-screen ads don't inflate counts). Clicks are server-side redirects through /oads-click/{id}/ (logged before the 302 redirect to the destination URL).
Time periods
| Key | Range |
|---|---|
7d | Last 7 days |
30d | Last 30 days |
90d | Last 90 days |
all | Since 2020-01-01 |
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
Revenue is estimated, not actual. For paid direct deals, enter the rates per ad and OAds reports your accrued spend.
PHP API
phpOAds_Tracker::record_impression( int $ad_id, string $page_url, string $section );
OAds_Tracker::record_click( int $ad_id );
$stats = OAds_Tracker::get_ad_stats( $ad_id, $period );
// Returns: [ impressions, clicks, ctr, revenue ]
OAds_Tracker::get_overview_stats( $period );
OAds_Tracker::get_recent_log( int $limit, string $type );
OAds_Tracker::export_csv( string $type, string $period );CSV export
AJAX action: oads_export_csv. Params: type (impressions or clicks), period (7d, 30d, 90d, all).
GDPR consent gate
When oads_settings['gdpr_consent'] is '1', frontend JS checks localStorage.getItem('oads_consent') === '1' before firing impression or click tracking. Your CMP sets this on consent:
javascriptlocalStorage.setItem('oads_consent', '1');
