HubSpot Master Forms
Created by: bretthayes
This closes #5409 (closed) and consolidates most of our HubSpot forms under 4 master forms that map to specific formId
s. Some forms that do not fall under the master forms still use the specific formId
backwards compatible syntax in the API.
Please take a look at our Master List to understand the mapping as well as the tech requirements.
Changelog
- Converted our HubSpot hook into a component for convenient rendering in markup for both MDX and non-MDX pages. This means the old
EmbeddedHubSpot
component is now deprecated in favour of one component to rule them all. The new API is much more simplistic for both cases. I will follow up with a PR to update the handbook section for embedded HubSpot forms after this PR is merged. - Added a
useLandingSource
hook to grab and store the initial landing source of a user insessionStorage
. This will be used to track landing sources in our HubSpot form submission data in case thesourcegraphSourceUrl
cookie doesn't contain any useful data - Consolidated all our contact pages in a more convenient template mapped index since they all use very similar props, content, and forms. This deprecates a lot of duplicated code into one template so we can handle contact page redesigns quicker in the future.
- Cleaned up some broken links on our abcs ebook page
- Updated our master forms in HubSpot to be more responsive
- Deprecated our FormLegal component since the form legal line is now included in each master form. I think this should be the standard going forward unless we feel otherwise.
- Also closes #5488 (closed) with some improved optimizations
- Added meta to terms sub pages/slug template
- Added custom form submission messages to HubSpotForms
- GatedResourceLayout updated to allow for a custom form submission message
- HubSpotForm form submission messages fall back with a generic message if none is provided
- window.open removed from guides pages for more preferred UX best practice (Safari and Firefox block popups by default)
- added tailwind whitespace utility class placeholder
- Restricted title prop to be a string only, for our GatedResourceLayout
Test
- Ensure prettier has standardized the proposed changes.
- Ensure every page that has a form renders the correct form. Please use the Master List for reference to check each new path and check the following:
- The
masterFormName
matches - If ChiliPiper is enabled/disabled
- The form submission message is correct
- The
- Ensure every contact page renders correctly
- Check that form data is submitted correctly:
- Start a new session at a random page (landing source) and navigate to a page with a form.
- Ensure the
anonymous_user_id
hidden form field is populated with thesourcegraphAnonymousUid
cookie data - Ensure the
first_source_url
hidden form field is populated with the landing source or thesourcegraphSourceUrl
if you started your session from the product and navigated to the about site through a CTA - Ensure that the
form_submission_source
is populated with the page you're submitting the form on. Submit a test submission and ensure all pieces of data are sent and captured in your form submission on HubSpot. You can find your contact in HubSpot by searching in Contacts for the email you used in your form submission.
- Check that no duplicate forms render when utm params or other query parameters are present in the URL
- Check all pages that use our
GatedResourceLayout
component and ensure form submission messages with links to the resources open properly when clicked
TODO
- We are waiting for our HS workflows to be configured so we can test all form submissions.
- Two redirects need to be created in HubSpot after this PR is merged
-
https://info.sourcegraph.com/talk-to-a-developer ->
/demo
, and; -
https://info.sourcegraph.com/team-pricing ->
/contact/team-pricing
-
https://info.sourcegraph.com/talk-to-a-developer ->