Conversion Bridge automatically maps conversion events to GA4 event names. For example, a form submission becomes generate_lead, a membership signup becomes sign_up, and a booking with a value becomes purchase.
Sometimes you need different event names, like a naming convention your team already uses in GA4.
If all you want is to switch form submissions between generate_lead and form_submit, there is a setting for that and you do not need any code. Go to Settings → Conversion Bridge → Google Analytics and open the Advanced section. See Form Submit Event Name.
Starting in version 1.13.1, you can change event types and event data using WordPress filters. Add the code snippets below to your theme's functions.php file or a custom plugin.
Change an Event Type
Use the conversion_bridge_ga4_event_type filter to rename any event before it's sent to GA4.
This example sends form submissions under a custom name instead:
add_filter(
'conversion_bridge_ga4_event_type',
function( $event_type, $event ) {
if ( in_array( $event_type, array( 'generate_lead', 'form_submit' ), true ) ) {
return 'lead_captured';
}
return $event_type;
},
10,
2
);
Notice that the example checks for both generate_lead and form_submit. This filter runs after Conversion Bridge has already mapped the event, so what arrives depends on the site: newer sites send generate_lead and sites set up before that became the default send form_submit. Checking for both means your code works either way.
The filter receives two parameters:
- $event_type (string) -- The GA4 event name after Conversion Bridge's mapping. Common values:
generate_lead,form_submit,purchase,sign_up,add_to_cart,begin_checkout,view_item - $event (array) -- The full event data array from Conversion Bridge, including
type,label,value,name, anditems
Change Event Type Based on Source
You can use the $event array to make decisions based on which integration triggered the event. The $event['name'] field contains the integration name (e.g., gravityforms_submission, wpforms_submission, woocommerce_purchase).
This example gives Gravity Forms submissions their own event name and leaves every other form alone:
add_filter(
'conversion_bridge_ga4_event_type',
function( $event_type, $event ) {
if ( in_array( $event_type, array( 'generate_lead', 'form_submit' ), true )
&& ! empty( $event['name'] )
&& $event['name'] === 'gravityforms_submission' ) {
return 'gravity_lead';
}
return $event_type;
},
10,
2
);
Add Custom Parameters to Events
Use the conversion_bridge_ga4_event_data filter to add, remove, or change the parameters sent with any GA4 event.
This example adds a custom lead_source parameter to all form submission events:
add_filter(
'conversion_bridge_ga4_event_data',
function( $event_data ) {
if ( ! empty( $event_data['form_id'] ) ) {
$event_data['lead_source'] = 'website_form';
}
return $event_data;
}
);
To see your custom parameters in GA4 reports, you'll need to create custom dimensions in your GA4 property settings. Conversion Bridge can do this automatically if you're connected via OAuth.
Add Internal Traffic Flag
This example adds a traffic_type parameter to events from logged-in administrators, so you can filter them out in GA4 reports:
add_filter(
'conversion_bridge_ga4_event_data',
function( $event_data ) {
if ( current_user_can( 'manage_options' ) ) {
$event_data['traffic_type'] = 'internal';
}
return $event_data;
}
);
Change the Conversion Value
This example doubles the conversion value for purchase events. Useful if your GA4 reports need to reflect a different value than what's collected at checkout (e.g., lifetime value calculations):
add_filter(
'conversion_bridge_ga4_event_data',
function( $event_data ) {
if ( ! empty( $event_data['value'] ) && ! empty( $event_data['items'] ) ) {
$event_data['value'] = $event_data['value'] * 2;
}
return $event_data;
}
);
Default Event Mappings
Here's how Conversion Bridge maps internal event types to GA4 event names by default. Use these as reference when writing your filter. The GA4 Event Name column is what your filter receives, not the internal type:
| Internal Event Type | GA4 Event Name |
|---|---|
| form_submit | generate_lead |
| generate_lead | generate_lead |
| register | sign_up |
| booking (with value) | purchase |
| donation | purchase |
| purchase | purchase |
| view_item | view_item |
| add_to_cart | add_to_cart |
| begin_checkout | begin_checkout |
| subscribe | subscribe |
The one exception is form submissions on sites set up before generate_lead became the default. Those still map to form_submit, which is why the examples above check for both names.
Related Filters
- conversion_bridge_ga4_event_type -- Developer reference for the event type filter
- conversion_bridge_ga4_event_data -- Developer reference for the event data filter
- conversion_bridge_platform_event -- Modify event data before it reaches any platform