Allows the HubSpot submission data to be filtered before being sent to HubSpot.


The following would apply to all forms:

add_filter( 'gform_hubspot_submission_data', 'your_function_name', 10, 4 );

To target a specific form, append the form id to the hook name. (format: gform_hubspot_submission_data_FORMID):

add_filter( 'gform_hubspot_submission_data_1', 'your_function_name', 10, 4 );



Change value for pageName (Conversion Page)

Use this code to send the title of the WordPress page where the form is embedded to HubSpot as the “Conversion Page”, rather than the default Form Title.

add_filter( 'gform_hubspot_submission_data', 'change_hubspot_submission_data', 10, 4 );
function change_hubspot_submission_data( $submission_data, $feed, $entry, $form ){
	global $post;
	$title = get_the_title( $post->ID );
	$submission_data['context']['pageName'] = $title;
	return $submission_data;

Using the following example a new contact will be created for each form submission, no matter if a cookie was set by the HubSpot tracking script in the visitor’s browser.

add_filter( 'gform_hubspot_submission_data', 'remove_cookie_value', 10, 4 );
function remove_cookie_value( $submission_data, $feed, $entry, $form ){
	GFCommon::log_debug( __METHOD__ . '(): running.' );
	unset( $submission_data['context']['hutk'] );
	return $submission_data;

This example shows how you can replace the default cookie created by the HubSpot tracking script with your own custom cookie to define the hutk property.

add_filter( 'gform_hubspot_submission_data', 'custom_cookie_value', 10, 4 );
function custom_cookie_value( $submission_data, $feed, $entry, $form ){
	$submission_data['context']['hutk'] = rgar( $_COOKIE, 'your-cookie-name' );
	return $submission_data;


This code should be placed in the functions.php file of your active theme.


This filter was added in HubSpot version 1.0.

Source Code

This filter is located in GF_HubSpot::generate_form_submission_object() in class-gf-hubspot.php.