WP Statistics icon
Analytics & Tracking

WP Statistics hooks reference

  • By VeronaLabs
  • v14.16.19 New
  • Updated

WP Statistics 14.16.19 has 24 actions and 131 filters, read directly from its source code on Nov 17, 2026. The list updates automatically when a new version is released.

How to use these hooks

Actions let you run your own code at a specific moment. Filters let you change a value before the plugin uses it. Put your code in a child theme's functions.php or a code-snippets plugin, never in the plugin's own files, because updates overwrite them.

functions.phpyour child theme
// Run your own code when WP Statistics fires an action
add_action( 'wp_statistics_after_report_email', function( $result_email, $email_receivers, $final_report_text ) {
	// Your code runs here.
}, 10, 3 );

// Change a value WP Statistics is about to use
add_filter( 'wp_statistics_active_user_online', function( $value ) {
	// Change $value here.
	return $value;
}, 10, 1 );

Parts of a name in {braces} are filled in at runtime (for example a post type or field ID). Choose Example on any hook for a ready-to-edit snippet.

All hooks

  • includes/libraries/wp-background-processing/wp-async-request.php line 158
    /**
     * Filters the post arguments used during an async request.
     */
    apply_filters( "{$this->identifier}_post_args", $args );
  • includes/libraries/wp-background-processing/wp-async-request.php line 112
    /**
     * Filters the post arguments used during an async request.
     */
    apply_filters( "{$this->identifier}_query_args", $args );
  • includes/libraries/wp-background-processing/wp-async-request.php line 132
    /**
     * Filters the post arguments used during an async request.
     */
    apply_filters( "{$this->identifier}_query_url", $url );
  • includes/libraries/wp-background-processing/wp-background-process.php line 516
    /**
     * Number of seconds to sleep between batches. Defaults to 0 seconds, minimum
     * 0.
     */
    apply_filters( "{$this->identifier}_seconds_between_batches", apply_filters( $this->prefix . '_seconds_between_batches', 0 ) );
  • includes/libraries/wp-background-processing/wp-async-request.php line 192
    /**
     * Should wp_die be used?
     */
    apply_filters( "{$this->identifier}_wp_die", true );
  • includes/libraries/wp-background-processing/wp-background-process.php line 518
    /**
     * Number of seconds to sleep between batches. Defaults to 0 seconds, minimum
     * 0.
     */
    apply_filters( "{$this->prefix}_seconds_between_batches", 0 );
  • includes/class-wp-statistics-user-online.php line 23
    /**
     * Disable/Enable User Online
     */
    apply_filters( 'wp_statistics_active_user_online', true );
  • includes/admin/class-wp-statistics-admin-assets.php line 520
    /**
     * Filter: wp_statistics_admin_assets
     */
    apply_filters( 'wp_statistics_admin_assets', $list );
  • includes/class-wp-statistics-admin-bar.php line 212
    /**
     * WP Statistics Admin Bar List
     */
    apply_filters( 'wp_statistics_admin_bar', $admin_bar_list, $data, '' );
  • includes/class-wp-statistics-menus.php line 175
    /**
     * WP Statistics Admin Page List
     */
    apply_filters( 'wp_statistics_admin_menu_list', $list );
  • includes/class-wp-statistics-schedule.php line 333
    /**
     * Fire actions after sending email
     */
    do_action( 'wp_statistics_after_report_email', $result_email, $email_receivers, $final_report_text );
  • includes/class-wp-statistics.php line 272
    /**
     * Create .htaccess to avoid public access.
     */
    apply_filters( 'wp_statistics_enable_htaccess_protection', true );
  • includes/class-wp-statistics-schedule.php line 303
    /**
     * Filter for email template content
     */
    apply_filters( 'wp_statistics_final_text_report_email', $email_content );
  • src/Service/Geolocation/AbstractGeoIPProvider.php line 203
    /**
     * Filter: wp_statistics_geolocation_download_url
     */
    apply_filters( 'wp_statistics_geolocation_download_url', $defaultUrl );
  • src/Service/Geolocation/GeolocationFactory.php line 77
    /**
     * Filter the geolocation provider name. This allows developers to change the
     * provider used for geolocation.
     */
    apply_filters( 'wp_statistics_geolocation_provider', $geoIpProvider );
  • includes/class-wp-statistics-helper.php line 2090
    /**
     * Trigger action after validating the hit request parameters.
     */
    do_action( 'wp_statistics_invalid_hit_request', $isValid, IP::getIP() );
  • includes/class-wp-statistics.php line 90
    /**
     * wp-statistics loaded
     */
    do_action( 'wp_statistics_loaded' );
  • src/Models/OnlineModel.php line 43
    /**
     * How many minutes a visitor counts as "online" for.
     */
    apply_filters( 'wp_statistics_online_visitors_timeframe', 5 );
  • includes/class-wp-statistics-option.php line 138
    /**
     * Filters a For Return WP Statistics Option
     */
    apply_filters( "wp_statistics_option_{$option_name}", $options[$option_name] );
  • src/Utils/Query.php line 850
    /**
     * Filter whether to allow caching in WP Statistics Query.
     */
    apply_filters( 'wp_statistics_query_allow_caching', $flag, $this );
  • includes/class-wp-statistics-schedule.php line 318
    /**
     * Email receivers
     */
    apply_filters( 'wp_statistics_report_email_receivers', Option::getEmailNotification() );
  • includes/class-wp-statistics-schedule.php line 308
    /**
     * Filter to modify email subject
     */
    apply_filters( 'wp_statistics_report_email_subject', self::getEmailSubject() );
  • includes/class-wp-statistics-schedule.php line 313
    /**
     * Filter for enable/disable sending email by template.
     */
    apply_filters( 'wp_statistics_report_email_template', true );
  • includes/class-wp-statistics-ip.php line 111
    /**
     * This Filter Used For Custom $_SERVER String
     */
    apply_filters( 'wp_statistics_sanitize_user_ip', sanitize_text_field($ip) );
  • includes/class-wp-statistics-visitor.php line 244
    /**
     * Trigger a WordPress action hook after saving the visitor relationship. This
     * allows for custom actions to be executed.
     */
    do_action( 'wp_statistics_save_visitor_relationship', $page_id, $visitor_id, $insert_id );
  • includes/class-wp-statistics-helper.php line 1852
    /**
     * Filters whether to show the WordPress admin bar.
     */
    apply_filters( 'wp_statistics_show_admin_bar', $showAdminBar );
  • src/Service/Database/Operations/Select.php line 53
    /**
     * Filter the prefix segment used between wpdb prefix and table name.
     */
    apply_filters( 'wp_statistics_table_prefix', 'statistics', $tableName );
  • includes/class-wp-statistics-ip.php line 185
    /**
     * Filters the list of trusted proxy IPs / CIDR ranges whose forwarding headers
     * are honoured when resolving the visitor IP.
     */
    apply_filters( 'wp_statistics_trusted_proxies', self::$private_SubNets );
  • src/Service/Admin/PageInsights/Views/TabsView.php line 201 · used in 3 places
    do_action( "wp_statistics_{$this->getCurrentPage()}_{$this->getCurrentTab()}_template", $args );
  • includes/libraries/wp-background-processing/wp-async-request.php line 150 · used in 2 places
    apply_filters( 'https_local_ssl_verify', false );
  • includes/admin/templates/layout/tabbed-page-header.php line 34 · used in 2 places
    do_action( 'wp_statistics_after_admin_page_title' );
  • includes/admin/templates/header.php line 84 · used in 2 places
    apply_filters( 'wp_statistics_enable_help_icon', true );
  • includes/admin/templates/header.php line 66 · used in 2 places
    apply_filters( 'wp_statistics_enable_upgrade_to_bundle', true );
  • src/Components/Assets.php line 83 · used in 2 places
    apply_filters( "wp_statistics_localize_{$handle}", $localize );
  • includes/libraries/wp-background-processing/wp-background-process.php line 208
    do_action( "{$this->identifier}_cancelled" );
  • includes/libraries/wp-background-processing/wp-background-process.php line 648
    do_action( "{$this->identifier}_completed" );
  • includes/libraries/wp-background-processing/wp-background-process.php line 619
    apply_filters( "{$this->identifier}_default_time_limit", 20 );
  • includes/libraries/wp-background-processing/wp-background-process.php line 586
    apply_filters( "{$this->identifier}_memory_exceeded", $return );
  • includes/libraries/wp-background-processing/wp-background-process.php line 237
    do_action( "{$this->identifier}_paused" );
  • includes/libraries/wp-background-processing/wp-background-process.php line 404
    apply_filters( "{$this->identifier}_queue_lock_time", $lock_duration );
  • includes/libraries/wp-background-processing/wp-background-process.php line 255
    do_action( "{$this->identifier}_resumed" );
  • includes/libraries/wp-background-processing/wp-background-process.php line 626
    apply_filters( "{$this->identifier}_time_exceeded", $return );
  • plugin_locale

    filter
    includes/class-wp-statistics.php line 292
    apply_filters( 'plugin_locale', determine_locale(), 'wp-statistics' );
  • src/Components/Assets.php line 64
    apply_filters( "wp_statistics_{$handle}_loading_strategy", $strategy );
  • includes/admin/templates/layout/tabbed-page-header.php line 116
    apply_filters( "wp_statistics_{$pageKey}_{$tabKey}_hidden", $tab['hidden'] ?? false );
  • includes/admin/templates/layout/tabbed-page-header.php line 114
    apply_filters( "wp_statistics_{$pageKey}_{$tabKey}_locked", $tab['locked'] ?? false );
  • includes/admin/templates/layout/tabbed-page-header.php line 115
    apply_filters( "wp_statistics_{$pageKey}_{$tabKey}_tooltip", $tab['tooltip'] ?? '' );
  • src/Abstracts/BaseTabView.php line 64
    apply_filters( "wp_statistics_{$this->getCurrentPage()}_{$this->getCurrentTab()}_data", [] );
  • src/Abstracts/MultiViewPage.php line 24
    apply_filters( "wp_statistics_{str_replace('-','_',$this->pageSlug)}_filters", $this->filters );
  • src/Abstracts/MultiViewPage.php line 20
    apply_filters( "wp_statistics_{str_replace('-','_',$this->pageSlug)}_views", $this->views );
  • src/Service/CustomEvent/CustomEventHelper.php line 54
    apply_filters( 'wp_statistics_active_custom_events', $activeCustomEvents );
  • includes/class-wp-statistics-pages.php line 18
    apply_filters( 'wp_statistics_active_pages', true );
  • includes/class-wp-statistics-visitor.php line 40
    apply_filters( 'wp_statistics_active_visitors', true );
  • src/Service/Admin/NoticeHandler/GeneralNotices.php line 46
    apply_filters( 'wp_statistics_admin_notices', $this->coreNotices );
  • includes/class-wp-statistics-menus.php line 72
    apply_filters( 'wp_statistics_admin_page_list', $admin_list_page );
  • includes/admin/class-wp-statistics-admin-ajax.php line 71
    apply_filters( 'wp_statistics_ajax_list', $list );
  • src/Service/HooksManager.php line 98
    apply_filters( 'wp_statistics_allowed_protocols', $customProtocols );
  • src/Components/Assets.php line 167
    apply_filters( 'wp_statistics_assets_handle', $handle );
  • src/Service/Database/Migrations/BackgroundProcess/BackgroundProcessManager.php line 421
    apply_filters( 'wp_statistics_async_background_process_ajax_interval', 5000 );
  • includes/class-wp-statistics-helper.php line 211
    apply_filters( 'wp_statistics_cache_status', $use );
  • includes/class-wp-statistics-visitor.php line 30
    apply_filters( 'wp_statistics_coefficient_per_visitor', self::$coefficient );
  • includes/class-wp-statistics-schedule.php line 208
    apply_filters( 'wp_statistics_cron_schedules', $schedules );
  • includes/class-wp-statistics-pages.php line 128
    apply_filters( 'wp_statistics_current_page', $current_page );
  • includes/class-wp-statistics-timezone.php line 17
    apply_filters( 'wp_statistics_current_timestamp', self::getCurrentDate('U') );
  • src/Service/CustomEvent/CustomEventHelper.php line 91
    apply_filters( 'wp_statistics_custom_event_name_validation', $isValid, $name );
  • src/Service/CustomEvent/CustomEventHelper.php line 20
    apply_filters( 'wp_statistics_custom_events', [] );
  • src/Abstracts/BaseModel.php line 46
    apply_filters( "wp_statistics_data_{child-method-name}_args", $args );
  • includes/admin/class-wp-statistics-admin-template.php line 241
    apply_filters( 'wp_statistics_date_time_range', $date_range );
  • includes/admin/class-wp-statistics-admin-template.php line 94
    apply_filters( 'wp_statistics_days_ago_request', self::$time_ago_days );
  • includes/class-wp-statistics-helper.php line 892
    apply_filters( 'wp_statistics_email_header', $emailHeader );
  • includes/class-wp-statistics-helper.php line 890
    apply_filters( 'wp_statistics_email_logo_url', get_bloginfo('url') );
  • includes/class-wp-statistics-helper.php line 831
    apply_filters( 'wp_statistics_email_template_layout', $email_template );
  • includes/class-wp-statistics-helper.php line 888
    apply_filters( 'wp_statistics_email_title', $emailTitle );
  • includes/admin/templates/header.php line 27
    apply_filters( 'wp_statistics_enable_header_addons_menu', true );
  • includes/admin/class-wp-statistics-admin-assets.php line 206
    apply_filters( 'wp_statistics_enqueue_chartjs', false );
  • src/Service/CustomEvent/CustomEventDataParser.php line 67
    apply_filters( 'wp_statistics_excluded_custom_events', [] );
  • includes/class-wp-statistics-exclusion.php line 91
    apply_filters( 'wp_statistics_exclusion', $exclude, $visitorProfile );
  • includes/class-wp-statistics-exclusion.php line 70
    apply_filters( 'wp_statistics_exclusion_list', array_keys(Exclusion::exclusion_list()) );
  • includes/class-wp-statistics-exclusion.php line 424
    apply_filters( 'wp_statistics_exclusion_robots', $robots );
  • src/Service/Admin/ExportImport/ExportImportHandler.php line 51
    apply_filters( 'wp_statistics_exporter_importer_drivers', $this->drivers );
  • includes/admin/templates/settings/add-ons/marketing.php line 67
    apply_filters( 'wp_statistics_google_auth_disconnect_url', '' );
  • includes/admin/templates/settings/add-ons/marketing.php line 66
    apply_filters( 'wp_statistics_google_auth_redirect_url', '' );
  • includes/admin/templates/settings/add-ons/marketing.php line 65
    apply_filters( 'wp_statistics_google_auth_test_url', '' );
  • includes/admin/templates/settings/add-ons/marketing.php line 64
    apply_filters( 'wp_statistics_google_auth_url', '' );
  • includes/class-wp-statistics-ip.php line 261
    apply_filters( 'wp_statistics_hash_ip', $truncatedHash );
  • src/Components/AssetNameObfuscator.php line 128
    apply_filters_deprecated( 'wp_statistics_hashed_asset_dir', [path_join($this->uploadsDir, $this->hashedFileName), $this->uploadsDir, $this->hashedFileName], '14.16.7', '', 'The obfuscator no longer writes a copy of the tracker into wp-content/uploads/.' );
  • src/Components/AssetNameObfuscator.php line 117
    apply_filters( 'wp_statistics_hashed_asset_name', $this->hashedFileName, $this->inputFileDir );
  • src/Components/AssetNameObfuscator.php line 124
    apply_filters_deprecated( 'wp_statistics_hashed_asset_root', [$this->uploadsDir], '14.16.7', '', 'The obfuscator no longer writes a copy of the tracker into wp-content/uploads/.' );
  • includes/admin/templates/header.php line 44
    apply_filters( 'wp_statistics_header_url', WP_STATISTICS_URL . 'assets/images/' . ($isPremium ? 'wp-statistics-premium.svg' : 'white-header-logo.svg') );
  • includes/class-wp-statistics-frontend.php line 110
    apply_filters( 'wp_statistics_html_comment', true );
  • includes/class-wp-statistics-helper.php line 2033
    apply_filters( 'wp_statistics_injection_patterns', $patterns );
  • src/Service/CustomEvent/CustomEventHelper.php line 17
    apply_filters( 'wp_statistics_internal_custom_events', [] );
  • includes/admin/templates/settings/advanced.php line 69
    apply_filters( 'wp_statistics_ip_detection_preview', $ip_method );
  • includes/class-wp-statistics-frontend.php line 79
    apply_filters( 'wp_statistics_js_check_time_interval', 60000 );
  • includes/admin/class-wp-statistics-admin-template.php line 322
    apply_filters( 'wp_statistics_location_column_value', $result, $location, $region, $city );
  • includes/class-wp-statistics-mail.php line 424
    apply_filters( 'wp_statistics_mail_attachments', $this->attachments, $this );
  • includes/class-wp-statistics-meta-box.php line 72
    apply_filters( 'wp_statistics_meta_box_class', self::$namespace . str_replace("-", "_", $meta_box), $meta_box );
  • includes/admin/class-wp-statistics-admin-assets.php line 296
    apply_filters( 'wp_statistics_meta_box_more_button', true );
  • src/Service/Admin/Metabox/MetaboxHelper.php line 56
    apply_filters( 'wp_statistics_metabox_list', self::$metaboxes );
  • src/Service/Admin/MiniChart/MiniChartHelper.php line 60
    apply_filters( 'wp_statistics_mini_chart_metric', $metric );
  • src/Service/Admin/NoticeHandler/GeneralNotices.php line 185
    apply_filters( 'wp_statistics_notice_db_row_threshold', 500000 );
  • includes/admin/templates/settings/add-ons/marketing.php line 68
    apply_filters( 'wp_statistics_oath_authentication_status', false );
  • includes/class-wp-statistics-option.php line 299
    apply_filters( "wp_statistics_option_{$setting_name}_{$option_name}", $options[$option_name] );
  • includes/class-wp-statistics-option.php line 341
    apply_filters( "wp_statistics_option_{$settingName}", $result );
  • includes/admin/pages/class-wp-statistics-admin-page-settings.php line 90
    apply_filters( 'wp_statistics_options', $wp_statistics_options );
  • includes/class-wp-statistics-pages.php line 182
    apply_filters( 'wp_statistics_page_uri', $page_uri );
  • views/pages/page-insights/entry-pages.php line 7
    apply_filters( 'wp_statistics_pages_entry-pages_locked', true );
  • views/pages/page-insights/exit-pages.php line 7
    apply_filters( 'wp_statistics_pages_exit-pages_locked', true );
  • includes/class-wp-statistics-pages.php line 281
    apply_filters( 'wp_statistics_pages_information', $pages );
  • views/pages/page-insights/overview.php line 128
    do_action( 'wp_statistics_pages_overview_entry_pages_widget' );
  • views/pages/page-insights/overview.php line 131
    do_action( 'wp_statistics_pages_overview_exit_pages_widget' );
  • includes/template-functions.php line 414
    apply_filters( 'wp_statistics_pages_where_type_query', $query, $id, $type );
  • src/Service/Admin/PrivacyAudit/PrivacyAuditDataProvider.php line 62
    apply_filters( 'wp_statistics_privacy_audits_list', $audits );
  • src/Service/Admin/PrivacyAudit/PrivacyAuditDataProvider.php line 40
    apply_filters( 'wp_statistics_privacy_faqs_list', $faqs );
  • includes/admin/class-wp-statistics-admin-privacy.php line 99
    apply_filters( 'wp_statistics_privacy_policy_content', $content );
  • includes/class-wp-statistics-visitor.php line 189
    do_action( 'wp_statistics_record_visitor', $visitor_id );
  • views/pages/referrals/campaigns.php line 7
    apply_filters( 'wp_statistics_referrals_campaigns_locked', true );
  • views/pages/referrals/google-search.php line 7
    apply_filters( 'wp_statistics_referrals_google-search_locked', true );
  • src/Service/Analytics/Referrals/ReferralsDatabase.php line 47
    apply_filters( 'wp_statistics_referrals_list', $result );
  • views/pages/referrals/overview.php line 107
    do_action( 'wp_statistics_referrals_overview_entry_pages_widget' );
  • views/pages/referrals/overview.php line 44
    apply_filters( 'wp_statistics_referrals_overview_glance_metrics', $metrics );
  • views/pages/referrals/overview.php line 97
    do_action( 'wp_statistics_referrals_overview_gsc_widgets' );
  • views/pages/referrals/overview.php line 87
    do_action( 'wp_statistics_referrals_overview_source_categories_widget' );
  • views/pages/referrals/utm-performance.php line 7
    apply_filters( 'wp_statistics_referrals_utm-performance_locked', true );
  • src/Components/RemoteRequest.php line 48
    apply_filters( 'wp_statistics_remote_request_args', $args );
  • src/Components/RemoteRequest.php line 42
    apply_filters( 'wp_statistics_remote_request_params', $params );
  • includes/class-wp-statistics-timezone.php line 202
    apply_filters( 'wp_statistics_request_days_format', $args['format'] );
  • includes/class-wp-statistics-helper.php line 1924
    apply_filters( 'wp_statistics_request_signature_enabled', true );
  • includes/class-wp-statistics-hits.php line 98
    apply_filters( 'wp_statistics_resolve_page_from_uri', $pageUri );
  • includes/class-wp-statistics-exclusion.php line 129
    do_action( 'wp_statistics_save_exclusion', $exclusion, $wpdb->insert_id );
  • includes/class-wp-statistics-pages.php line 321
    do_action( 'wp_statistics_save_page', $page_id, $page );
  • includes/admin/pages/class-wp-statistics-admin-page-settings.php line 105
    do_action( 'wp_statistics_save_settings' );
  • includes/class-wp-statistics-visitor.php line 75
    do_action( 'wp_statistics_save_visitor', $visitor_id, $visitor, $visitorProfile->getCurrentPageType() );
  • includes/class-wp-statistics-purge.php line 16
    apply_filters( 'wp_statistics_schedule_db_maint_days', 30 );
  • includes/class-wp-statistics-search-engine.php line 52
    apply_filters( 'wp_statistics_search_engine_list', $engines );
  • src/Service/Admin/Posts/PostsManager.php line 101
    apply_filters( 'wp_statistics_show_taxonomy_hits', true );
  • includes/admin/templates/pages/content-analytics/single.php line 78
    apply_filters( 'wp_statistics_single_content_analytics_glance_metrics', $metrics, $postId );
  • includes/admin/templates/pages/content-analytics/single.php line 128
    do_action( 'wp_statistics_single_content_search_console_widgets' );
  • src/Service/Analytics/Referrals/SourceChannels.php line 35
    apply_filters( 'wp_statistics_source_channels_list', $channels );
  • includes/class-wp-statistics-db.php line 183
    do_action( 'wp_statistics_truncate_table', str_ireplace(self::prefix() . 'statistics_', "", $table_name) );
  • includes/class-wp-statistics-visitor.php line 169
    do_action( 'wp_statistics_update_visitor_hits', $visitor_id, $same_visitor );
  • includes/class-wp-statistics-ip.php line 87
    apply_filters( 'wp_statistics_use_trusted_proxy_resolution', false );
  • src/Service/Analytics/DeviceDetection/UserAgent.php line 14
    apply_filters( 'wp_statistics_user_http_agent', isset($_SERVER['HTTP_USER_AGENT']) ? sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])) : '' );
  • includes/class-wp-statistics-user.php line 40
    apply_filters( 'wp_statistics_user_id', $user_id );
  • includes/class-wp-statistics-ip.php line 126
    apply_filters( 'wp_statistics_user_ip', sanitize_text_field($ip) );
  • includes/class-wp-statistics-referred.php line 70
    apply_filters( 'wp_statistics_user_referer', $referred );
  • includes/class-wp-statistics-visitor.php line 179
    apply_filters( 'wp_statistics_visitor_data_before_update', $data, $visitorProfile );
  • includes/class-wp-statistics-visitor.php line 155
    apply_filters( 'wp_statistics_visitor_information', $visitor );
  • views/pages/visitor-insights/overview.php line 40
    apply_filters( 'wp_statistics_visitors_overview_glance_metrics', $metrics );
  • views/pages/visitor-insights/overview.php line 121
    do_action( 'wp_statistics_visitors_overview_hourly_traffic_widget' );
  • views/pages/visitor-insights/search-terms.php line 7
    apply_filters( 'wp_statistics_visitors_search-terms_locked', true );

Generated from WP Statistics's GPL-licensed source code. Hooks inside bundled third-party libraries are not listed.

Can't find the right hook?

We can build the customisation for you. Describe what you need: