Reading Data from URL Parameters
With Convertful you can easily read data from URL parameter and use it for the data enrichment, input fields prefilling, and personalization. In this article, we'll describe how it works and how you can use it.
How It Works #
Input fields in your Convertful "Form Fields" element got a "Name" string, for example:
To create a URL parameter that will define the value for such field, use the name with the prefix "conv_" as parameter name, and specify its value after the equation. For the screenshot above that would be: "conv_text=example", where "example" is the value for the text field.
When using it as the URL parameter, remember the syntax for adding parameters to the URL. When you add the first parameter to the URL, it starts with the "?" symbol. And when you add more than one, each additional parameter starts with the "&" symbol in the URL string.
Thus, when you use only one parameter, the syntax would be:
https://mysite.com/?conv_text=example
When you're using multiple parameters, the syntax would be:
https://mysite.com/?conv_text=example&conv_first_name=John&[email protected]
Below, we provide examples of using parameters for every input field type.
URL Parameters Examples #
Email, First Name, Last Name, Phone, Company, Site #
We refer to these fields as default fields and the name string for those is predefined and is not showing during editing. Use examples below to add URL parameters for those.
For the Email field:
https://mysite.com/[email protected]
For the First Name field:
https://mysite.com/?conv_first_name=John
For the Last Name field:
https://mysite.com/?conv_last_name=Doe
For the Phone field:
https://mysite.com/?conv_phone=123456789
For the Company field:
https://mysite.com/?conv_company=ACME
For the Site field:
https://mysite.com/?conv_site=example.com
-
Custom Text #
For this field you can change the name string while editing:
The URL parameter name forms as the "Name" string with the "conv_" prefix. For the default value it would be:
For the Custom Text field:
https://mysite.com/?conv_text=mytext
-
Date Field #
For this field, you need to use the specific value format: "mm/dd/yyyy" to read the date correctly.
For the Date field:
https://mysite.com/?conv_date=12/01/2020
-
Dropdown and Radio Fields #
Dropdown and Radio fields got a specific control for specifying the label and value for the options to choose from:
To set up the correct URL parameter for those, you need to use the name string ("radio" or "dropdown" by default) as the parameter name with the "conv_" prefix and use the label ("Option N" by default) as the parameter value.
For the Radio field:
https://mysite.com/?conv_radio=Option 1
For the Dropdown field:
https://mysite.com/?conv_dropdown=Option 1
-
Rating Field #
Rating fields' control is similar to Dropdown and Radio and contains labels for the available options.
To read it from the URL parameter you need to use the name string ("rating" by default) with the "conv_" prefix as parameter name, and label of the needed option as the parameter value.
For the Rating field:
https://mysite.com/?conv_rating=Good
-