conversion_bridge_meta_api_user_data
Description
The conversion_bridge_meta_api_user_data filter allows you to modify the user data sent to the Meta Conversions API before the server-side request is made. User data includes hashed personally identifiable information (email, phone, name, etc.), browser cookiesA small piece of data stored in a user’s browser that helps websites remember user activity, preferences, or sessions across visits. (fbp, fbc), and other identifiers that Meta uses for event matching.
This filter only applies to the Conversions API (server-side). There is no Pixel-side equivalent because the Meta Pixel handles user data matching automatically in the browser.
Usage
add_filter( 'conversion_bridge_meta_api_user_data', 'my_hook_function', 10, 2 );
add_filter( 'conversion_bridge_meta_api_user_data', 'my_hook_function', 10, 2 );
Parameters
$user_data(array) The user data array that will be sent in the Conversions API request. May include hashed values forem(email),ph(phone),fn(first name),ln(last name),ct(city),st(state),zp(zip),country,external_id,fbp,fbc,client_ip_address, andclient_user_agent$data(array) The original event data array from Conversion Bridge
Example
Add an external_id to Meta CAPI requests using the current WordPress user ID, which helps Meta match events to user profiles for better attributionThe process of determining which channels, campaigns, or actions contributed to a conversion, helping you understand what influenced a visitor’s decision to take action.:
add_filter(
'conversion_bridge_meta_api_user_data',
function( $user_data, $data ) {
if ( is_user_logged_in() ) {
$user_data['external_id'] = hash( 'sha256', (string) get_current_user_id() );
}
return $user_data;
},
10,
2
);
add_filter(
'conversion_bridge_meta_api_user_data',
function( $user_data, $data ) {
if ( is_user_logged_in() ) {
$user_data['external_id'] = hash( 'sha256', (string) get_current_user_id() );
}
return $user_data;
},
10,
2
);
Still need help?
If you have not yet found your answer in the documentation articles, please contact support
Contact support