conversion_bridge_meta_event_data
Description
The conversion_bridge_meta_event_data filter allows you to modify the event data object sent with the Meta Pixel fbq() tracking call. This is the data payload that accompanies the event type — 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 the pixel fires.
This filter only affects the Meta Pixel (browser-side). To also modify event data for the Conversions API (server-side), use the conversion_bridge_meta_api_event_data filter.
Usage
add_filter( 'conversion_bridge_meta_event_data', 'my_hook_function', 10, 1 );
add_filter( 'conversion_bridge_meta_event_data', 'my_hook_function', 10, 1 );
Parameters
$event_data(array) The event data array that will be JSON-encoded and passed tofbq()as the data parameter
Example
Add a content_category property to all Meta Pixel purchase events so you can break down purchases by category in Meta Ads reporting:
add_filter(
'conversion_bridge_meta_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_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