Hooks

Hooks: Notifications and Eligibility

9 min read

These hooks cover on-page notification create/update/delete, settings sanitization (general, timing, behavior, appearance), campaign linkage, and the eligibility REST pipeline that decides what the frontend receives.

Index: Hook Reference Hub. REST details: REST API Reference. Example: Cookbook: Modify Notification Before Display.

Display rules and content source pools are documented separately in Display Rules and Content Source.

Notification CRUD (actions)

HookParametersDescription
notifal/onpage_notification/savednoneNotification saved successfully
notifal/onpage_notification/meta_savednoneNotification meta saved
notifal/onpage_notification/trashedint $notification_idNotification moved to trash
notifal/onpage_notification/deletedint $notification_id, string $statusNotification permanently deleted
notifal/onpage_notification/duplicatedint $original_id, int $new_idNotification duplicated
notifal/onpage_notifications/trash_emptiedint $deleted_countTrash emptied for notifications
notifal/onpage/notification/status/toggle/beforenoneBefore status toggle from list view
notifal/onpage/notification/status/toggle/afternoneAfter status toggle
notifal/onpage/timing/schedule_incoming_parse_failednoneSchedule start/end string could not be parsed during sanitization

Notification save and load (filters)

HookParametersDescription
notifal/onpage_notification/sanitized_dataarray $sanitized, array $raw_dataSanitized payload before DB write
notifal/onpage_notification/post_dataarray $post_data, array $sanitized_datawp_insert_post / update args
notifal/onpage_notification/loaded_dataarray $data, WP_Post $postData loaded for editor
notifal/onpage_notifications/total_countint $totalOverride total count in list view
notifal/onpage_notifications/status_tabsarray $tabsStatus tabs in notifications list

Import and export (filters)

HookParametersDescription
notifal/export/onpage_notification_dataarray $dataExport JSON before download
notifal/onpage_notification/import/resultarray $result, string $filePathImport result after processing
notifal/onpage_notification/import/post_statusstring $status, array $notification_dataPost status for imported notification (default draft)

Cache invalidation (actions)

HookParametersDescription
notifal/onpage_notification/cache_clearednoneNotification caches cleared
notifal/onpage_notification/elementor_cache_clearednoneElementor caches cleared
notifal/onpage_notification/order_pool_cache_clearednoneOrder pool cache cleared
notifal/onpage_notification/product_pool_cache_clearednoneProduct pool cache cleared
notifal/onpage_notification/frontend_template_cache_clearednoneFrontend template cache cleared
notifal/onpage_notification/wp_object_cache_clearednoneWordPress object cache cleared
notifal/onpage_notification/all_caches_clearednoneAll notification caches manually cleared

Preview (actions)

HookParametersDescription
notifal/onpage/preview/beforeWP_Post $postBefore notification preview page
notifal/onpage/preview/afterWP_Post $postAfter notification preview page

Template preview hooks: Templates and Rendering.

Campaign hooks

HookTypeParametersDescription
notifal/campaign/savedactionnoneCampaign saved
notifal/campaign/deletedactionnoneCampaign trashed
notifal/campaign/status_changedactionint $campaign_id, array $previous_meta, array $new_metaCampaign status changed
notifal/campaign/schedule_checkfilterbool $should_show, int $campaign_id, WP_Post $notificationOverride campaign schedule eligibility
notifal/notification/campaign_schedulefilterarray $schedule, int $campaign_id, int $notification_idResolved schedule when campaign overrides notification
notifal/campaign/onpage_picker/search_resultsfilterarray $items, string $searchRows in campaign notification picker AJAX search

Eligibility REST pipeline

Used by GET /wp-json/notifal/v1/onpage/eligible.

Actions

HookParametersDescription
notifal/onpage/eligibility/before_processnoneBefore eligibility request is processed
notifal/onpage/eligibility/after_processnoneAfter eligibility request completes

Filters

HookParametersDescription
notifal/onpage/eligibility/dataarray $eligibility_data, array $contextFinal payload sent to frontend
notifal/onpage/eligibility/global_eligiblebool $is_global_eligible, \WP_Post $notification, array $contextExclude inline notifications from floating injection
notifal/onpage/frontend/localized_configarray $config, array $contextnotifalOnPageConfig before script localization
notifal/onpage/frontend/immediate_preload_notificationsarray $notifications, array $contextImmediate notifications embedded in page HTML
notifal/onpage/user/eligibilitybool $is_eligible, array $notification, array $user_contextPer-notification user eligibility
notifal/onpage/notification/contentarray $notification, array $contextNotification record before frontend delivery
notifal/onpage/frontend/contextarray $contextPage context passed to JavaScript
notifal/onpage/archive_context_post_typesstring[] $postTypesArchive pseudo post types in visitor context
notifal/onpage/api/rate_limit_settingsarray $rate_limit_settingsRate limits for eligibility/tracking endpoints

Frontend asset loading (filters)

HookParametersDescription
notifal/onpage/frontend/should_load_assetsbool $should_loadForce or skip OnPage frontend assets
notifal/onpage/page/contains_notificationsbool $contains_notificationsPage contains notification markup
notifal/onpage/has_active_notificationsbool $has_notificationsActive notifications exist for current request
notifal/onpage/template/rendered_assetsarray $assets, string $html, WP_Post $templateExtra CSS/JS when a rendered template needs them (Forms uses this)
notifal/onpage/compat/wp_armour_enabledbool $enabledWhether WP Armour compatibility runs for popup forms

Asset registration actions: Lifecycle and Bootstrap.

General settings (filters)

HookParametersDescription
notifal/onpage/general/default_settingsarray $settingsDefault general settings
notifal/onpage/general/sanitized_settingsarray $sanitized_settings, array $raw_settingsSanitized general settings

Timing settings (filters)

HookParametersDescription
notifal/onpage/timing/default_settingsarray $settingsDefault timing settings
notifal/onpage/timing/sanitized_settingsarray $sanitized, array $raw_settingsSanitized timing before save
notifal/onpage/timing/display_configarray $config, array $settingsWhen to show (delays, scroll, etc.)
notifal/onpage/timing/duration_configarray $config, array $settingsHow long to show
notifal/onpage/timing/frequency_configarray $config, array $settingsShow frequency and session limits
notifal/onpage/timing/advanced_configarray $config, array $settingsAdvanced timing (tab behavior, sessions)
notifal/onpage/timing/should_showbool $should_show, array $settings, array $contextOverride timing show decision
notifal/onpage/timing/js_configarray $js_config, array $settingsTiming config localized to JavaScript

Behavior settings (filters)

HookParametersDescription
notifal/onpage/behavior/default_settingsarray $settingsDefault behavior settings
notifal/onpage/behavior/sanitized_settingsarray $sanitized, array $raw_settingsSanitized behavior before save
notifal/onpage/behavior/interaction_configarray $config, array $settingsDismiss and click handling
notifal/onpage/behavior/animation_configarray $config, array $settingsAnimation type, duration, easing
notifal/onpage/behavior/accessibility_configarray $config, array $settingsARIA, focus, screen reader settings
notifal/onpage/behavior/advanced_configarray $config, array $settingsScroll lock, form handling, state
notifal/onpage/behavior/mobile_configarray $config, array $settingsMobile/touch behavior
notifal/onpage/behavior/js_configarray $js_config, array $settingsBehavior config for JavaScript
notifal/onpage/behavior/tab_badge_configarray $tab_badge_config, array $settingsBrowser tab badge configuration
notifal/onpage/tab_badge/frontend_configarray $frontend_configTab badge config sent to JS

Frontend accessibility (filters)

HookParametersDescription
notifal/onpage/frontend/accessibility_configarray $config, array $behaviorSettingsFrontend accessibility manager config
notifal/onpage/frontend/aria_attributesarray $ariaAttributes, array $accessibilityConfig, array $notificationDataARIA attributes on notification elements
notifal/onpage/frontend/focus_trap_configarray $focusTrapConfig, array $accessibilityConfig, array $notificationDataFocus trap for keyboard navigation
notifal/onpage/frontend/screen_reader_configarray $screenReaderConfig, array $accessibilityConfig, array $notificationDataScreen reader announcements
notifal/onpage/frontend/accessibility_data_attributesarray $dataAttributes, array $accessibilityConfig, array $notificationDataData attributes for a11y detection

Appearance settings (filters)

HookParametersDescription
notifal/onpage/appearance/default_settingsarray $settingsDefault appearance settings
notifal/onpage/appearance/sanitized_settingsarray $sanitized, array $raw_settingsSanitized appearance before save
notifal/onpage/appearance/position_settingsarray $position_settings, array $settings, string $deviceDesktop/mobile position config
notifal/onpage/appearance/position_cssstring $css, array $position_settings, string $deviceGenerated positioning CSS
notifal/onpage/appearance/default_audio_filesarray $audio_filesBuilt-in audio file options
notifal/onpage/appearance/audio_file_urlstring $url, string $filenameResolved audio file URL
notifal/onpage/appearance/frontend_configarray $config, array $settingsAppearance config for frontend
notifal/onpage/appearance/display_type_optionsarray $optionsDisplay type select options (Pro adds inline)
notifal/onpage/topbar/header_selectorstring $selectorCSS selector for "above header" top bar placement
notifal/onpage/topbar/above_header_compat_cssstring $cssExtra inline CSS for sticky header compatibility
notifal/onpage/animation/typesarray $animation_typesAvailable animation types

Tab badge (actions)

HookParametersDescription
notifal/onpage/tab_badge/title_updatestring $new_title, int $countDocument title updated with badge count
notifal/onpage/tab_badge/title_restorestring $original_titleOriginal document title restored
notifal/onpage/tab_badge/favicon_updatearray $badge_config, string $original_faviconFavicon overlay applied
notifal/onpage/tab_badge/favicon_restorestring $original_faviconOriginal favicon restored

AI prompt configuration (filters)

These filters still shape layout, use case, and example data for the OnPage Generate with AI wizard. Full AI hooks: Hooks: Notifal AI.

HookParametersDescription
notifal/onpage/ai_prompt/configarray $configOnPage AI prompt config for JavaScript
notifal/onpage/ai_prompt/export_samplearray $sampleSample export JSON embedded in AI prompt

Admin OnPage assets (actions)

HookParametersDescription
notifal/admin_onpage/assets/before_enqueueWP_Screen $screenBefore OnPage admin assets enqueue
notifal/admin_onpage/assets/after_enqueueWP_Screen $screenAfter OnPage admin assets enqueue
notifal/admin_onpage/list/assets/before_enqueuenoneBefore OnPage list admin assets
notifal/admin_onpage/list/assets/after_enqueuenoneAfter OnPage list admin assets

Editor tab/section hooks: Admin UI Extension.

Labels and admin search (filters)

HookParametersDescription
notifal/onpage/labels/get_terms_argsarray $argsget_terms args for label options
notifal/onpage/labels/optionsarray $optionsLabel slug => name map
notifal/onpage/admin_search/resultsarray $results, string $post_type, string $keywordAJAX post search results
notifal/onpage/admin_search/user_resultsarray $results, string $keywordAJAX user search results
notifal/onpage/translationsarray $translationsOnPage JavaScript translations

Tag context for notifications (filter)

HookParametersDescription
notifal/onpage/tag/contextarray $context, array $contentSourceSettings, array $pageContextDynamic tag context during frontend render

Full tag system: Tags and Dynamic Data.

Hooks series

  1. Hook Reference Hub
  2. Hooks: Lifecycle and Bootstrap
  3. Hooks: Notifications and Eligibility (you are here)
  4. Hooks: Templates and Rendering
  5. Hooks: Tags and Dynamic Data
  6. Hooks: Display Rules and Content Source
  7. Hooks: Analytics and Tracking
  8. Hooks: Admin UI Extension
  9. Hooks: Pro Integration Bridge