Skip to content

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 cookies (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

  1. $user_data (array) The user data array that will be sent in the Conversions API request. May include hashed values for em (email), ph (phone), fn (first name), ln (last name), ct (city), st (state), zp (zip), country, external_id, fbp, fbc, client_ip_address, and client_user_agent
  2. $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 attribution:

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