URL Parameters

The article introduces URL Parameters and explains how they can be used to customize and analyze surveys based on known information.

πŸ’‘ This article covers

Passing known parameters into a survey using the survey URL 

πŸ”¨ How it works

  1. After adding URL parameter names to the parameter list in your Survey Editor, you can use these parameters to build survey links.
  2. Select the URL Parameters you'd like to use with your survey link by checking the relevant boxes next to the parameter name.
  3. Copy and paste the link wherever you plan to distribute the survey.

Note: When you distribute your survey link, you will need to ensure that the placeholder values are replaced with the values you want passed into your Segmanta survey. 

Values can be inserted manually or your CRM system or email marketing client should have an automated process for attaching values to parameters.

Here's an example of how the final survey link will appear when the respondent takes the survey. As you can see, we added the URL parameters for first_name and last_name.

Note: URL parameters are limited to 100 per survey and parameters over 100 will not be saved.

Understanding the structure of a survey link with URL parameters

Segmanta enables you to add parameter names to your survey link. Simply fill in the values for each of the parameters using your distribution methodology.

As an example, we will add the following parameters into the query string of a survey link. 

  • First name
  • Last name
  • Age 

Let's say the following two respondents took the survey:

  1. Mark Zuckerberg, Age 17
  2. Jane Doe, Age 27

Now, let's break it down:

https://surveys.segmanta.com/publicid  
This is your survey link without any URL Parameters.

first_name and last_name are names of parameters
You can define any parameters and any number of parameters you'd like. 
Each parameter has to be encoded using an equivalent of the encodeURIComponent.

first_name=value1
last_name=value2

mark and zuckerberg are values
Each value has to be encoded using an equivalent of the encodeURIComponent. Unlike parameters, generally, values will change with each survey respondent.

first_name=mark
last_name=zuckerberg

This is the format template of the survey link:

surveys.segmanta.com/surveyId/?first_name=value1&last_name=value2&age=value

This is the survey link of the example:

surveys.segmanta.com/123abc/?first_name=mark&last_name=zuckerberg&age=17

Passing URL parameters into an embedded survey

πŸ’ͺ When to use it

  • To make a URL parameter available in a Segmanta survey that is embedded into your website using a Segmanta embed code or Segmanta Dynamic Embed mechanism.

πŸ”¨ How it works

  • To pass parameters that will be associated with the user’s responses, you should expose a global variable called:

    SEGMANTA__USER_METADATA

Pro-tip: For example, including the following <script> tag will associate  all responses with a Travel category on your website:

<script>

   window.SEGMANTA__USER_METADATA = {

       category: "travel"

}

</script>
  • You can pass any keys inside SEGMANTA__USER_METADATA, except for a few keys which are reserved: host, widget, lang and embed_type.

Setting up survey logic based on URL parameters

🏠 Where it lives

  • Go to the Survey Editor and click on Logic.

πŸ”¨ How it works

  • Add a Logic Rule and set a Condition using a URL Parameter.
    • You can add a logic rule using a URL parameter as the condition either by:
      • Selecting from one of the URL parameters available in the dropdown menu. URL parameters will appear in the dropdown menu if you have added them on the Distribute > Link tab.
      • Typing a new parameter into the field. 
    • Grab your survey link from the Distribute tab or test your survey by using the preview mode to ensure the logic is set up as you desired.

Pro-tip: You can set up multiple logic rules or rules on different questions based on different URL parameters.

  • Make sure to include the custom fields as URL Parameters in the survey URL or your survey logic will not work.
  • You do not need to set a value for the URL parameter and can set up the logic condition to Go To/Show/Skip based on there being any value for the URL parameter at all by defining the logic rule based on Not Blank.

URL parameter use cases

Below, we outline four URL parameter use cases.

1. Enrichment

πŸ’Ό What it does: Matches your survey responses to your database in order to enrich consumer profiles or associate feedback with a certain customer using Zapier.

2. Survey Logic

πŸ’Ό What it does: Sets up survey logic based on any parameter you pass into the survey (such as the examples above).

3. Data Analysis

πŸ’Ό What it does: Analyzes your survey based on previously known information passed through URL Parameters such as Gender, Age, Consumer Group, or Subscription Tier. 

4. Content Customization

πŸ’Ό What it does: Personalizes your survey using the URL Parameters you have chosen by customizing the content on any page of your survey with information you pass with URL Parameters.

πŸ’ͺ When to use it:

      • To engage your users

      • To increase survey response rates

Pro-tip: Make your survey questions highly relevant to a respondent.

πŸ”¨ How it works

      • Decide what parameters you want to pass and what you would like to name the parameter. Parameters can be named anything, except for a few parameters that are reserved, such as $lang (used for multi-language surveys). 

      • Encode the parameter using an equivalent of the encodeURIComponent.

      • Add the parameter to a survey page by copying:

$url_param[parameter]
      • Paste the code where you want the parameter to appear.

      • Replace the word "parameter" with the parameter you have chosen.

      • Set up your URL using the custom fields you have defined above (and any other custom fields you'd like to include).

      • Then, test the survey using the URL you set up and an example value/s by taking the survey in an incognito window. 

Note: A custom field can be placed anywhere on your survey's Welcome Page, Ending Page or in a question page's Question Content. You cannot place custom fields into answer choices.

Analyze results using Custom Fields passed as URL Parameters

πŸ’ͺ When to use it

  • Incorporate known information about a respondent into your survey's Analytics Dashboard by analyzing the custom fields you incorporated in a survey URL or an embedded survey.

🏠 Where it lives

  • Navigate to the Question View of your survey's Analytics Dashboard.
πŸ”¨ How it works
  • Click + Add Segment to create a segment from your data.
  • Navigate to the Custom Params tab and select the custom parameter you would like to use to filter your data.
  • Choose which values you would like to include or include a filter for all respondents who have any value for that custom parameter.

Customize your survey content using the URL Parameters

For example, you want to display your customer John Doe's first and last name in the survey's welcome page. 

  • Go to the Survey Editor and click on the Welcome Page. Type "$url_param[first_name]!" into the text field. 

  • Create your survey link using the parameters you decided to insert into the survey.

John's survey link would look like this:

https://surveys.segmanta.com/123abc?first_name=John&last_name=Doe

  • Test the survey link. Now, when John clicks the survey link, this is how the Welcome Page will appear to him.