Wpd Ai Event Tracking Enable Logging

Alpha Insights Documentation

Docs Navigation

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

Got A Question?

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Alpha Insights

Alpha Insights

The World's Most Advanced WooCommerce Profit Reporting Engine

5/5 – Trustpilot

Alpha Insights