Passing Custom Parameters to a Framed Embed

When using the framed embed type, you can pass custom parameters to your calculator by adding data-embed-* attributes to the parent <div>. These parameters are then accessible in your calculator's formulas using the EMBED_PARAM() function.

How to Use

Here's an example of how to embed a calculator with a custom parameter:

<div
  class="calculator"
  data-calc-id="NPEpSNWCA6PpBTfXp"
  data-type="framed"
  data-embed-country="NL"
  data-embed-currency="EUR">
</div>

<script src="https://scripts.convertcalculator.com/embed.js" async></script>

In this example, two custom parameters are passed:

  • data-embed-country="NL"
  • data-embed-currency="EUR"

Inside your calculator formulas, you can access these values with:

EMBED_PARAM('country')  // returns 'NL'
EMBED_PARAM('currency') // returns 'EUR'

How EMBED_PARAM() Works

  • EMBED_PARAM(name) takes a single string argument—the name of the parameter (without the data-embed- prefix).
  • The argument is case-insensitive, so EMBED_PARAM('country') and EMBED_PARAM('COUNTRY') return the same result.
  • The returned value is case-sensitive and matches the value you defined in the embed code.
  • If a parameter is not provided, the function returns an empty value (null).

You Can Add Multiple Custom Parameters

You can define as many data-embed-* attributes as needed, and reference each one individually with EMBED_PARAM() in your formulas.

This is useful for:

  • Personalizing calculators based on region
  • Passing referral data
  • Enabling/limiting features based on embedding context

Related articles

Learn more about embed parameters in one of the following articles