## Filter: wpd_ai_event_tracking_enable_logging

Enable or disable debug logging for the WooCommerce event tracking (REST endpoint and event insertion).

### Description

The event tracking class uses this filter to decide whether to write debug logs (e.g. request payloads, insert results). When true, logging is sent via `wpdai_write_log()`. The filter is applied when the class initializes its `$enable_logging` property and again when logging. Default is false.

#### Location

File: `includes/classes/WPDAI_Woocommerce_Event_Tracking.php`

Context: Property initialization and when writing log messages.

### Parameters

Parameter | Type | Description
--- | --- | ---
$enable_logging | bool | Current value (default false). Return true to enable event tracking debug logs.

#### Return

Type: bool

True to enable event tracking logging; false to disable.

### Example Usage

#### Enable when WP_DEBUG is on

    add_filter( 'wpd_ai_event_tracking_enable_logging', function( $enable_logging ) {
        return defined( 'WP_DEBUG' ) && WP_DEBUG;
    } );

#### Enable in local environment only

    add_filter( 'wpd_ai_event_tracking_enable_logging', function( $enable_logging ) {
        return wp_get_environment_type() === 'local';
    } );

### Related Filters

- wpd_ai_event_data_before_insertion – Modify event data
- wpd_ai_session_tracking_enable_logging – Session tracking logging