conversion_bridge_meta_api_event_data
Description
The conversion_bridge_meta_api_event_data filter allows you to modify the event data (custom_data) sent to the Meta Conversions API before the server-side request is made. This is the data payload that accompanies the event — things like value, currency, content_name, contents, and any custom properties.
This runs after Conversion Bridge has prepared the event data for Meta's format. Use it to add, remove, or change data fields before they are sent to Meta's server.
This is the server-side counterpart to conversion_bridge_meta_event_data. When you modify event data, you typically want to apply the same changes to both Pixel and CAPI so they match for deduplicationDeduplication prevents the same conversion from being counted twice. It keeps your data accurate and is handled automatically by Conversion Bridge..
Usage
add_filter( 'conversion_bridge_meta_api_event_data', 'my_hook_function', 10, 1 );
add_filter( 'conversion_bridge_meta_api_event_data', 'my_hook_function', 10, 1 );
Parameters
$event_data(array) The event data array that will be sent ascustom_datain the Conversions API request
Example
Add a content_category property to all Meta CAPI purchase events to match the same customization applied on the Pixel side:
add_filter(
'conversion_bridge_meta_api_event_data',
function( $event_data ) {
if ( ! empty( $event_data['content_type'] ) && 'product' === $event_data['content_type'] ) {
$event_data['content_category'] = 'Physical Products';
}
return $event_data;
}
);
add_filter(
'conversion_bridge_meta_api_event_data',
function( $event_data ) {
if ( ! empty( $event_data['content_type'] ) && 'product' === $event_data['content_type'] ) {
$event_data['content_category'] = 'Physical Products';
}
return $event_data;
}
);
Still need help?
If you have not yet found your answer in the documentation articles, please contact support
Contact support