## Filter: wpd_ai_event_tracking_block_request_by_data

Decide whether to block an event from being stored based on the prepared event payload.

### Description

After normalizing the event data, the plugin may set `$block_request = true` when the request URL does not contain the site domain (e.g. to avoid storing events from other sites). This filter receives that decision and the full `$data` array so you can add your own rules (e.g. block by event_type, user_id, or custom fields). Return true to block the event (it will not be inserted).

#### Location

File: `includes/classes/WPDAI_Woocommerce_Event_Tracking.php`

Method: Used when validating whether to block the request based on event data (e.g. `page_href` not containing site domain).

### Parameters

Parameter | Type | Description
--- | --- | ---
$block_request | bool | Whether the request is currently marked to be blocked
$data | array | The prepared event payload (e.g. session_id, page_href, event_type, event_value, additional_data, etc.)

#### Return

Type: bool

True to block the event; false to allow it to be stored.

### Example Usage

#### Block events with zero value

    add_filter( 'wpd_ai_event_tracking_block_request_by_data', 'block_zero_value_events', 10, 2 );
    function block_zero_value_events( $block_request, $data ) {
        if ( isset( $data['event_value'] ) && (float) $data['event_value'] <= 0 ) {
            return true;
        }
        return $block_request;
    }

#### Block specific event types

    add_filter( 'wpd_ai_event_tracking_block_request_by_data', 'block_internal_events', 10, 2 );
    function block_internal_events( $block_request, $data ) {
        $blocked_types = array( 'internal_test', 'debug_click' );
        if ( ! empty( $data['event_type'] ) && in_array( $data['event_type'], $blocked_types, true ) ) {
            return true;
        }
        return $block_request;
    }

### Related Filters

- wpd_ai_event_data_before_insertion – Modify event data before insert
- wpd_ai_event_tracking_prevent_foreign_referrals – Block foreign referers