Ad Groups & Rotation
Groups pool multiple ads and serve them according to a rotation policy.
Rotation types
| Type | Behavior |
|---|---|
| Random (Weighted) | Each ad drawn randomly, weighted by _oads_weight. Weight 3 is 3× more likely than weight 1. |
| Round-robin | Strict sequence. Pointer stored in oads_group_rr_pointers option. |
| A/B Split | Weighted random until any variant reaches 100+ impressions, then OAds_Groups::maybe_pick_winner() compares CTR and locks the winner. |
Setting up a group
- OAds → Ad Groups → New Group
- Set rotation type
- In each ad editor, set Ad Group field to this group
- Set Weight (1–10) per ad for weighted rotation
- Use
[oads]normally — the group logic picks the ad
OAds_Groups PHP API
phpOAds_Groups::get_all(): array
OAds_Groups::get_by_id( int $id ): ?object
OAds_Groups::get_ads_in_group( int $group_id ): array
OAds_Groups::pick_ad( int $group_id ): ?WP_Post
OAds_Groups::maybe_pick_winner( int $group_id ): void
OAds_Groups::save( array $data ): int|false
OAds_Groups::delete( int $id ): bool