EMBEDPARAM
Retrieves a custom parameter passed to your embedded form or calculator. Use EMBEDPARAM to personalize experiences based on data from the embedding page.
Syntax
EMBEDPARAM("key")Parameters:
key(String) โ The name of the parameter to retrieve
Returns: The parameter value as text, or empty if not found.
How it works
When you embed a ConvertSite form or calculator on your website, you can pass custom parameters through the embed code. EMBEDPARAM reads those parameters in your formulas.
The function only works in embedded contexts. If you use it in a standalone page or preview, it returns an error.
Adding parameters to your embed
Paste your embed snippet onto your page, then add custom parameters as data-* attributes on the <iframe>. The script tag must come before the iframe, so the loader can rewrite the iframe address before it loads.
<script src="https://www.convertsite.com/static/js/apps/frontstage/framed.js"></script>
<iframe
class="convertsite"
src="https://www.convertsite.com/frontstage/framed/APP_ID"
style="border: none; width: 100%;"
data-country="US"
data-campaign="summer-sale"
data-referral-code="SUMMER2024">
</iframe>Each data-* attribute on the iframe becomes a parameter you can read with EMBEDPARAM.
You can also configure parameters without editing the embed code. In the editor, select the parent Embed component and add them in the inspector's "Embed parameters" group (see Embed). The manual data-* method above still works.
Reading parameters in formulas
EMBEDPARAM("country") // Returns "US"
EMBEDPARAM("campaign") // Returns "summer-sale"
EMBEDPARAM("referral-code") // Returns "SUMMER2024"Key matching rules
Case-insensitive:
EMBEDPARAM("Country")andEMBEDPARAM("country")both workOptional
data-prefix: You can include or omitdata-in the key name โ bothEMBEDPARAM("country")andEMBEDPARAM("data-country")return the same valueUnderscores and hyphens are equivalent:
EMBEDPARAM("referral_code")matchesdata-referral-codeValue is case-sensitive: The returned value preserves the exact case from the embed
Examples
Personalize pricing by region
IF(EMBEDPARAM("region") = "EU",
PRICE * 1.21, // Add EU VAT
PRICE) // No tax for other regionsApply referral discounts
IF(EMBEDPARAM("referral") = "PARTNER50",
TOTAL * 0.5, // 50% partner discount
TOTAL)Show targeted content
IF(ISEMPTY(EMBEDPARAM("campaign")),
"Welcome!",
CONCAT("Welcome, ", EMBEDPARAM("campaign"), " visitor!"))Handle missing parameters
IF(ISEMPTY(EMBEDPARAM("discount")),
PRICE, // No discount code
PRICE * (1 - EMBEDPARAM("discount"))) // Apply discountTips
EMBEDPARAM only works when your form is embedded on another website. It will not work in preview mode or on standalone ConvertSite pages.
Use
ISEMPTY(EMBEDPARAM("key"))to check if a parameter exists before using itCombine with
IFto provide fallback values when parameters are missingPass UTM parameters, user IDs, or session data from your CMS to personalize forms
Common mistakes
Using the function in preview: EMBEDPARAM only works in live embeds. In the editor, in preview, or on a standalone ConvertSite page it returns the error "EMBEDPARAM can only be used in embeds"
Passing query parameters instead of data attributes: Parameters in the host page URL (for example
?customer_id=123) do not reach EMBEDPARAM. Add them asdata-*attributes on the iframe insteadForgetting quotes: The key must be a text string:
EMBEDPARAM("country")notEMBEDPARAM(country)Expecting a default value: EMBEDPARAM returns empty when a parameter is missing, not an error โ use
IForIFERRORto handle this
See also
GET ยท IF ยท ISEMPTY ยท FormulaScript Overview