Google Analytics 4: Change default event types
Conversion Bridge automatically maps conversion events to GA4 event names. For example, a form submission becomes form_submit, a membership signup becomes sign_up, and a booking with a value becomes purchase.
Sometimes you need different event names. Maybe your reporting setup expects generate_lead instead of form_submit. Or you want to send a custom event name that matches a naming convention your team already uses in GA4.
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 changes form_submit events to GA4's recommended generate_lead event:
add_filter(
'conversion_bridge_ga4_event_type',
function( $event_type, $event ) {
if ( 'form_submit' === $event_type ) {
return 'generate_lead';
}
return $event_type;
},
10,
2
);
The filter receives two parameters:
- $event_type (string) -- The GA4 event name after Conversion Bridge's mapping. Common values:
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 sends Gravity Forms submissions as generate_lead but leaves other form submissions as form_submit:
add_filter(
'conversion_bridge_ga4_event_type',
function( $event_type, $event ) {
if ( 'form_submit' === $event_type && ! empty( $event['name'] ) && $event['name'] === 'gravityforms_submission' ) {
return 'generate_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:
| Internal Event Type | GA4 Event Name |
|---|---|
| form_submit | form_submit |
| 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 |
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
Still need help?
If you have not yet found your answer in the documentation articles, please contact support
Contact support