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
- Open a page, landing page, blog post or blog listing in the HubSpot editor.
- Click Add, search for ROI Calculator and drag it into a section.
- 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:
| Field | What it does |
|---|---|
| Formula name | The name you use in formulas, for example team_size. Letters, numbers and underscores only, starting with a letter. Capitals are ignored. |
| Label, Help text | Text shown to visitors. |
| Control | Slider, Number field, Option buttons or Dropdown. |
| Starting value, Minimum, Maximum, Step | Value 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 as | Number, 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 value | For example h or people. Include a space if you want one. |
| Options | For 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.
| Function | Example |
|---|---|
| min, max | max(0, current - new_price) |
| round(x, decimals), floor, ceil | round(savings / 12, 2) |
| abs, sqrt, pow | pow(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
- Currency code: USD, EUR, GBP or any three-letter ISO code.
- Number format language: leave empty to follow the page language (for example 1,234.50 in English and 1.234,50 in Spanish), or enter a code such as
en-GB. - Short large numbers: shows 52,164 as 52.2K.
- Animate result changes: numbers count to their new value. Visitors who prefer reduced motion never see the animation.
5. Lead form
- In Content › Lead form, switch on Show a HubSpot form.
- Choose the form, and write the form heading and text.
- 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
- In HubSpot, click the settings icon and go to Data Management › Properties. In some accounts the menu is simply Properties.
- Make sure Contact properties is selected and click Create property.
- Choose a group (for example Contact information, or create a group called ROI calculator) and write a label, for example ROI annual savings.
- 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.
- 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 value | Property label | Field type | Internal name |
|---|---|---|---|
savings | ROI annual savings | Number (Currency) | roi_annual_savings |
hours_saved | ROI hours saved per year | Number | roi_hours_saved |
summary | ROI calculator summary | Multi-line text | roi_summary |
Step 2 · Add the properties to your form as hidden fields
- Go to Marketing › Forms and open the form you will use with the calculator.
- In the list of contact properties, search for each property you created and drag it into the form.
- 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.
- Click Update or Publish to save the form.
Step 3 · Connect the values in the module
- In the page editor, select the calculator and open Content › Save results in the CRM.
- Add one row per property:
- Value: the formula name of a result or input (for example
savings), orsummary. - Contact property internal name: the internal name you copied (for example
roi_annual_savings).
- Value: the formula name of a result or input (for example
- 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
- Open the published page, change some values and send the form with a test email address.
- 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 see | What 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 empty | Check 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 empty | Results 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
| Group | What you can change |
|---|---|
| Text | Fonts of the eyebrow, heading and description, alignment, eyebrow colour. |
| Background | Module, inputs panel, results panel and form panel colours. |
| Border, Corner | Panel border, panel corners and corners of fields and buttons. |
| Spacing | Padding and margin, space inside panels, between panels and between inputs. |
| Layout | Results beside or below the inputs, inputs column width, maximum width and alignment. |
| Inputs | Label and value fonts, help text colour, slider track and fill, active option, field background and border. |
| Results | Fonts, sizes of the highlighted and other results, highlight colour, automatic or manual text colour. |
| Form, Button | Form 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
- Every input has a visible label and works with the keyboard. Option buttons behave as a radio group (arrow keys, Home, End).
- The results area is announced to screen readers when it changes. Rename it in Content › Accessibility.
- Animations respect the reduced motion setting.
9. Good to know
- Use as many calculators as you like on one page. Each one works on its own.
- Below 860 px wide the results always go below the inputs.
- No jQuery, no external libraries and no third-party accounts. Formulas are read by a built-in parser, never executed as code.
- Results are estimates based on your formulas. Add a note under the result to explain your assumptions.
Support
Email info@digitalmakers.cat in English, Spanish or Catalan.