Opti-Behavior exposes a set of real WordPress action and filter hooks you can use to extend or customize behavior. Every hook below exists in the plugin source. Use the standard add_action() and add_filter() functions in your own plugin or theme.
Action hooks #
| Hook | Fires when |
|---|---|
opti_behavior_ab_variant_served |
An A/B variant is served to a visitor |
opti_behavior_ab_test_status_changed |
A test moves between statuses (e.g. draft → running) |
opti_behavior_ab_test_started / opti_behavior_ab_test_completed |
A test starts or completes |
opti_behavior_ab_winner_declared / opti_behavior_ab_winner_applied / opti_behavior_ab_winner_reverted |
A winning variant is declared, applied or reverted |
opti_behavior_smart_insight_saved / opti_behavior_smart_insight_generated |
A Smart Insight is generated or stored |
opti_behavior_smart_insights_register_signals |
The signal registry is built (register custom signals here) |
opti_behavior_pro_modules_loaded |
Pro modules finish loading |
opti_behavior_ab_ga4_conversion |
A GA4 conversion is dispatched (Pro) |
Filter hooks #
| Filter | Lets you |
|---|---|
opti_behavior_protected_scripts |
Add files/handles that cache plugins must not optimize |
opti_behavior_tracker_modules |
Adjust which tracker modules load |
opti_behavior_form_adapters |
Register a custom form adapter for Form Analytics (Pro) |
opti_behavior_smart_insights_registered_signals / opti_behavior_smart_insights_signals |
Filter the set of Smart Insights signals |
opti_behavior_ab_variant_assignment / opti_behavior_ab_traffic_weights |
Override variant assignment or traffic weights |
opti_behavior_dashboard_export_datasets |
Add or modify CSV export datasets |
opti_behavior_page_analytics_metrics |
Filter per-page analytics metrics |
opti_behavior_report_subject / opti_behavior_report_content |
Customize scheduled report email subject and body |
Example: register a protected script #
add_filter( 'opti_behavior_protected_scripts', function ( $scripts ) {
$scripts['files'][] = 'my-custom-tracker.js';
return $scripts;
} );
Expected result #
Your callback runs at the documented point, letting you extend Opti-Behavior without editing plugin files.
FAQ #
Are these hooks stable? #
They exist in v1.7.2. As with any plugin, confirm a hook still fires after major updates.
Is there a hook to add a Smart Insights signal? #
Yes. Use the opti_behavior_smart_insights_register_signals action; see Smart Insights overview.