Appearance
Hooks and Filters
The Lindris WordPress plugin provides a comprehensive set of action hooks and filter hooks that allow developers to extend and customize functionality.
TIP
For many event-related filters, there are per-integration filters (e.g. lindris_{$integration}_track_{$event_name}_tags_to_update) as well as global filters (e.g. lindris_track_tags_to_update). The global filters allow you to affect all integrations/events in one place.
API Request Actions
lindris_api_request_complete
Fired when an API request completes successfully
php
/**
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
* @param string $url The API URL that was requested
* @param array $payload The data payload that was sent
*/
do_action( 'lindris_api_request_complete', $api_client, $url, $payload );lindris_api_request_complete_with_error
Fired when an API request completes with an error
php
/**
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
* @param string $url The API URL that was requested
* @param array $payload The data payload that was sent
*/
do_action( 'lindris_api_request_complete_with_error', $api_client, $url, $payload );lindris_track_event_error
Fired when tracking an event encounters an error
php
/**
* @param \WP_Error $result The error object
* @param string $object The event object (subscription, order, product, customer, user)
* @param string $action The event action (created, updated, deleted, completed)
* @param array $event_properties The event properties
* @param string $email The contact email
* @param string $integration The integration ID
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
*/
do_action( 'lindris_track_event_error', $result, $object, $action, $event_properties, $email, $integration, $api_client );Integration Lifecycle Actions
lindris_{$integration}_track_{$event_name}
Fired when tracking events for a specific integration.
The $integration and $event_name parts will be replaced with the actual integration ID and event name (e.g., lindris_woocommerce_track_order_completed).
php
/**
* @param array $event_properties The event properties
* @param string $email The contact email
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
*/
do_action( "lindris_{$integration}_track_{$event_name}", $event_properties, $email, $api_client );lindris_{$integration}_track_{$event_name}_error
Fired when an error occurs tracking an event for a specific integration.
The $integration and $event_name parts will be replaced with the actual integration ID and event name (e.g., lindris_woocommerce_track_order_completed_error).
php
/**
* @param \WP_Error $result The error object
* @param array $event_properties The event properties
* @param string $email The contact email
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
*/
do_action( "lindris_{$integration}_track_{$event_name}_error", $result, $event_properties, $email, $api_client );Integration Lifecycle Filters
lindris_{$integration}_track_{$event_name}_tags_to_update
Used to modify the tags to update when tracking an event for a specific integration.
The $integration and $event_name parts will be replaced with the actual integration ID and event name (e.g., lindris_woocommerce_track_order_completed_tags_to_update).
php
/**
* @param array $lifecycle_tags Array of tags to add or remove
* @param array $event_properties The event properties
* @param string $email The contact email
* @return array
*/
$tags_to_update = apply_filters( "lindris_{$integration}_track_{$event_name}_tags_to_update", $lifecycle_tags, $event_properties, $email, $api_client );lindris_track_tags_to_update
Used to modify the tags to update for any event, regardless of integration or event name.
php
/**
* @param array $tags Array of tags to add or remove
* @param string $integration The integration ID
* @param string $event_name The event name
* @param array $event_properties The event properties
* @param string $email The contact email
* @return array
*/
$tags_to_update = apply_filters( 'lindris_track_tags_to_update', $tags, $integration, $event_name, $event_properties, $email );lindris_{$integration}_track_{$event_name}_custom_fields_to_update
Used to modify the custom fields to update when tracking an event for a specific integration.
The $integration and $event_name parts will be replaced with the actual integration ID and event name (e.g., lindris_woocommerce_track_order_completed_custom_fields_to_update).
php
/**
* @param array $custom_fields Array of custom fields to update
* @param array $event_properties The event properties
* @param string $email The contact email
* @return array
*/
$custom_fields_to_update = apply_filters( "lindris_{$integration}_track_{$event_name}_custom_fields_to_update", $custom_fields, $event_properties, $email );lindris_track_custom_fields_to_update
Used to modify the custom fields to update for any event, regardless of integration or event name.
php
/**
* @param array $fields Array of custom fields to update
* @param string $integration The integration ID
* @param string $event_name The event name
* @param array $event_properties The event properties
* @param string $email The contact email
* @return array
*/
$fields_to_update = apply_filters( 'lindris_track_custom_fields_to_update', $fields, $integration, $event_name, $event_properties, $email );lindris_{$integration}_track_{$event_name}_event_properties
Fired when tracking an event for a specific integration.
The $integration and $event_name parts will be replaced with the actual integration ID and event name (e.g., lindris_woocommerce_track_order_completed_event_properties).
php
/**
* @param array $event_properties The event properties
* @param string $event_id The event object ID
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
* @return array
*/
$event_properties = apply_filters( "lindris_{$integration}_track_{$event_name}_event_properties", $event_properties, $event_properties['id'], $api_client );lindris_track_event_properties
Used to filter event properties for any event, regardless of integration or event name. If a non-array value is returned, the event will not be tracked.
php
/**
* @param array $event_properties The event properties
* @param string $integration The integration ID
* @param string $event_name The event name
* @param string $event_id The event object ID
* @param \Lindris\Plugin\Api\Client $api_client The API client instance
* @return array|false
*/
$event_properties = apply_filters( 'lindris_track_event_properties', $event_properties, $integration, $event_name, $event_properties['id'], $api_client );Usage Examples
Adding Custom Tags to WooCommerce Orders
php
/**
* Add custom tags when a WooCommerce order is completed.
*/
function add_custom_tags_to_woo_order($lifecycle_tags, $event_properties) {
if (isset($event_properties['total']) && (int) $event_properties['total'] > 100) {
$lifecycle_tags['high-value-customer'] = true;
}
return $lifecycle_tags;
}
add_filter('lindris_woocommerce_track_order_completed_tags_to_update', 'add_custom_tags_to_woo_order', 10, 2);Environment-Based Helpers & Global Filters
TIP
These filters make it easy to block, log, or modify Lindris events and API requests in non-production environments (like staging or development).
The Lindris plugin provides global filters that let you:
- Prevent all event tracking or API requests in staging/dev
- Log events instead of sending them
- Apply custom logic to all integrations/events at once
Below are practical examples for common use-cases.
| Filter Name | Type | Description | Example Use |
|---|---|---|---|
lindris_track_event | action | Fires when any event is tracked | Log or block events globally |
lindris_track_event_properties | filter | Filter event properties before tracking. Return non-array to block. | Block all events in staging |
lindris_track_tags_to_update | filter | Filter tags to update for any event | Add/remove tags dynamically |
lindris_track_custom_fields_to_update | filter | Filter custom fields to update for any event | Add custom fields conditionally |
lindris_process_api_request_args | filter | Filter outgoing API requests. Return empty array to block. | Prevent API calls in dev/test |
Example: Prevent All Event Tracking in Non-Production
php
add_filter( 'lindris_track_event_properties', function( $event_properties ) {
if ( 'production' !== wp_get_environment_type() ) {
return false; // Prevent all event tracking in non-production
}
return $event_properties;
} );Example: Prevent All API Requests in Non-Production
php
add_filter( 'lindris_process_api_request_args', function( $args ) {
if ( 'production' !== wp_get_environment_type() ) {
return []; // Block all outgoing API requests
}
return $args;
} );Example: Prevent All People API Requests
php
add_filter( 'lindris_process_api_request_args', function( $request_args, $endpoint ) {
// Prevent people requests.
if ( '/people' === $endpoint ) {
return [];
}
return $request_args;
}, 10, 2 );Example: Log Events Before Sending
php
add_action( 'lindris_track_event', function( $event_properties, $integration, $event_name, $email ) {
if ( 'production' !== wp_get_environment_type() ) {
error_log( sprintf( 'Lindris %s event (%s): %s', $integration, $event_name, print_r( compact( 'event_properties', 'email' ), true ) ) );
}
}, 10, 4 );Example: Modify Tags or Custom Fields
php
add_filter( 'lindris_track_tags_to_update', function( $tags, $integration, $event_name, $event_properties, $email ) {
// Add a tag for a specific event
if ( $event_name === 'order_created' ) {
$tags['special-order'] = true;
}
return $tags;
}, 10, 5 );
add_filter( 'lindris_track_custom_fields_to_update', function( $fields, $integration, $event_name, $event_properties, $email ) {
// Add a person custom field for a specific integration
if ( $integration === 'woocommerce' ) {
$fields['promotion'] = 'Black Friday';
}
return $fields;
}, 10, 5 );