ROI Calculator

Build an interactive calculator with your own inputs and formulas, send the results to a HubSpot form and, if you like, show them only after the form is sent. Works in any HubSpot theme.

Saving the results in your CRM needs a one-time manual setup: you create the contact properties and add them to your form as hidden fields. The module can't do this for you. See section 6 for the steps.

1. Add the module to a page

  1. Open a page, landing page, blog post or blog listing in the HubSpot editor.
  2. Click Add, search for ROI Calculator and drag it into a section.
  3. The module starts with a working example (automation savings). Change its inputs and results, or replace them with your own.

2. Inputs

Add up to 10 inputs in Content › Inputs. Each one has:

FieldWhat it does
Formula nameThe name you use in formulas, for example team_size. Letters, numbers and underscores only, starting with a letter. Capitals are ignored.
Label, Help textText shown to visitors.
ControlSlider, Number field, Option buttons or Dropdown.
Starting value, Minimum, Maximum, StepValue on page load and the allowed range. For option buttons and dropdowns, the starting value selects the option with the same value.
Show the value asNumber, Currency or Percentage. Used for the value next to sliders and in the form summary. A number field with Currency shows the currency symbol.
Text before / after the valueFor example h or people. Include a space if you want one.
OptionsFor option buttons and dropdowns: a label and a value for each option. The formula uses the value.

3. Results and formulas

Add up to 6 results in Content › Results. Each result has a formula name, a label, a formula, a format (Number, Currency or Percentage), decimals, optional text before and after, a note, and Highlight this result to show it large at the top.

Writing formulas

Use the formula names of inputs, and of any result above the current one. Operators: + - * / ^ and brackets. Comparisons > < >= <= == != give 1 or 0.

FunctionExample
min, maxmax(0, current - new_price)
round(x, decimals), floor, ceilround(savings / 12, 2)
abs, sqrt, powpow(1 + rate / 100, years)
if(condition, then, else)if(seats > 50, price * 0.9, price)

Example from the default calculator:

hours_saved = team * hours * 46 * saving / 100
savings     = hours_saved * rate
monthly     = savings / 12

Percentages are entered as whole numbers (35 means 35%), so divide by 100 in the formula. If a formula has a mistake, a yellow message in the page editor tells you which result to check. Visitors never see it.

4. Numbers and currency

5. Lead form

  1. In Content › Lead form, switch on Show a HubSpot form.
  2. Choose the form, and write the form heading and text.
  3. Choose the Results visibility.

The calculator works with any HubSpot form. Without the setup in section 6, the form still creates or updates the contact, but the calculator numbers are not saved in it.

Results visibility

Always show the results keeps the numbers visible. Blur the results until the form is sent hides them behind a message until the visitor submits the form. Once sent, the results stay visible for the rest of that browser session.

Blurring is a visual invitation, not a security measure: the numbers are calculated in the browser. Don't use it for information that must stay private.

Without a form

Switch off Show a HubSpot form and fill in Button (when no form is shown) to show a button in the results panel instead, for example to a meetings page.

6. Save results in the CRM (manual setup required)

Important: the module cannot create contact properties or change your forms. To store the calculator numbers in each contact record you must create the properties and add them to your form yourself, once per HubSpot account. It takes about five minutes, and you need permission to edit properties and forms.

The numbers reach the contact through hidden fields of your form: the calculator fills them, and HubSpot saves them when the visitor sends the form.

Step 1 · Create one contact property per value

  1. In HubSpot, click the settings icon and go to Data Management › Properties. In some accounts the menu is simply Properties.
  2. Make sure Contact properties is selected and click Create property.
  3. Choose a group (for example Contact information, or create a group called ROI calculator) and write a label, for example ROI annual savings.
  4. Choose the field type:
    • Number for a single result. Use the Currency number format for money values.
    • Multi-line text for summary, which sends all inputs and results as readable text.
  5. Copy the internal name shown under the label (for example roi_annual_savings) and create the property. You can't change the internal name later.

For the default calculator we suggest:

Calculator valueProperty labelField typeInternal name
savingsROI annual savingsNumber (Currency)roi_annual_savings
hours_savedROI hours saved per yearNumberroi_hours_saved
summaryROI calculator summaryMulti-line textroi_summary

Step 2 · Add the properties to your form as hidden fields

  1. Go to Marketing › Forms and open the form you will use with the calculator.
  2. In the list of contact properties, search for each property you created and drag it into the form.
  3. Select the field and turn on the hidden option (Hidden field, or Make this field hidden in the legacy form editor). Leave the default value empty.
  4. Click Update or Publish to save the form.

Step 3 · Connect the values in the module

  1. In the page editor, select the calculator and open Content › Save results in the CRM.
  2. Add one row per property:
    • Value: the formula name of a result or input (for example savings), or summary.
    • Contact property internal name: the internal name you copied (for example roi_annual_savings).
  3. Check the area under the calculator. In the page editor, a yellow message lists anything that is missing. If there is no message, the setup is complete. Visitors never see these messages.

Step 4 · Test it

  1. Open the published page, change some values and send the form with a test email address.
  2. Open that contact in CRM › Contacts and look for the new properties. They contain the values the visitor saw when sending the form.

If the numbers don't appear in the contact

What you seeWhat to do
Yellow message: "Add this contact property to the form as a hidden field"The property is not in the form, or the internal name in the module is mistyped. Compare it with Settings › Properties.
Yellow message: "… is not a formula name of this calculator"The Value must match the formula name of an input or result exactly. The message lists the valid names.
The property exists, but stays emptyCheck that the form you added it to is the same form chosen in the module, and that the form was updated after adding the field.
A number property shows an error or is emptyResults are sent as plain numbers (for example 52164.4). Use a Number property, or a text property if you prefer the formatted value from summary.

7. Styles tab

GroupWhat you can change
TextFonts of the eyebrow, heading and description, alignment, eyebrow colour.
BackgroundModule, inputs panel, results panel and form panel colours.
Border, CornerPanel border, panel corners and corners of fields and buttons.
SpacingPadding and margin, space inside panels, between panels and between inputs.
LayoutResults beside or below the inputs, inputs column width, maximum width and alignment.
InputsLabel and value fonts, help text colour, slider track and fill, active option, field background and border.
ResultsFonts, sizes of the highlighted and other results, highlight colour, automatic or manual text colour.
Form, ButtonForm heading font, blur strength, button colours and font.

Fonts and colours start from your theme's heading font, body font, primary colour and secondary colour. Change any of them here to override. Text on coloured panels and buttons switches between black and white for contrast unless you set it manually. The form fields themselves keep your theme's form styles.

8. Accessibility

9. Good to know

Support

Email info@digitalmakers.cat in English, Spanish or Catalan.