used plugins:
Gravity Forms 2.9.13
Gravity Forms HubSpot Add-On: 2.1.0
Problem description: For a client I’m replacing hubspot forms with Gravity Forms. Due to a bunch of query parameters the urls can get very long (mostly more than 200 characters). In hubspot the field value fore “First page seen” is truncated after 200 characters, which leads to wrong campaign attributions.
I could narrow down the problem to Line 1767 in the class-gf-hubspot.php from the Gravity Forms Hubspot Add-On:
$context = array(
‘pageUri’ => $this->get_page_uri( rgar( $entry, ‘source_url’ ) ),
‘pageName’ => $form[‘title’],
);
If the Hubspot Pixel is not firing (e.g. user opted-out for tracking script) the source_url is used as a fallback. Since the url is limited to 200 characters, the truncated url is forwarded to Hubspot.
I had two workarounds in mind:
replace the source_url with a custom field e.g. orginal_url → this is problematic since the field id can be different from form to form. It’s correct that I can only address custom fields in the entry object using the field ids, right? So I could not use “original_url” and only the id e.g. ‘7’
Increase the length of the source_url → I adjusted the Length in the database from 200 to 500 characters. However, the url is still truncated. → Do you know by any chance why the length is not updated?
The value is also truncated via PHP before the entry properties are saved to the database.
You can suggest removing the character limit from the entry source_url property in both the database and PHP directly to the product management team for consideration when planning future releases on the Gravity Forms product roadmap page.
For now, the workaround is to use a hidden field with the {embed_url} merge tag in the default value setting, and the gform_hubspot_submission_data filter to update the context pageUri with the value e.g.
thanks a lot for your quick reply and this awesome support. I tested your solution on a DEV environment and created a custom plugin for our Live Page.
I will also follow your advice and create a feature request. In the meantime for anybody facing the same problem (basically when you’re using Hubspot and GF in conjunction), I’ll probably upload my custom plugin to wordpress.org with a short tutorial.
Just in case this thread is closed, try searching for Gravity Forms Hubspot url truncation fix or Gravity Forms increase source url length