Skip to main content

Use and manage query strings in Dotdigital form URLs

Use query strings in Dotdigital form URLs to personalise forms, capture hidden data, and improve segmentation.

Bartlomiej Rekosiewicz avatar
Written by Bartlomiej Rekosiewicz
Updated this week

Query strings let you pass information into hidden fields in your forms, helping you personalise the user experience and collect valuable data for reporting and segmentation. This guide walks you through how to set them up, best practices to follow, and how to troubleshoot common issues.

Before you start

Things you need to know:

  • You need a published form in your Dotdigital account.

  • Make sure you’ve added any hidden fields you want to populate.


What are query strings?

Query strings in Dotdigital form URLs are a flexible and effective way to enhance form usability and data collection. By following these practices, leveraging hidden fields, and managing potential challenges proactively, you can maximize the impact of your Dotdigital campaigns.

In Dotdigital, a query string is the part of a URL that comes after the question mark (?) and contains key-value pairs, such as:

https://www.example.com/?mykey=myvalue

You can include multiple pairs separated by &:

https://www.example.com/?key1=value1&key2=value2

A query string assigns values to specific fields in your forms. These values, when pre-filled, streamline data collection and personalize the user journey. For example, passing a query string allows users to see pre-filled fields or lets you gather information about the context of an interaction.

You can include multiple query strings in a Dotdigital form URL, as each string corresponds to a specific hidden field that is then filled when the user accesses the form.


Add query strings to a form URL

  1. Copy your form URL.

  2. Add a question mark (?) at the end of the URL.

  3. Add your key-value pairs, for example:

    [FORM_URL] owner=@LEADOWNER@&Important_factors=@IMPORTANT_FACTORS@

  4. Make sure each key matches a hidden field in your form.


Use query strings in email campaigns

You can pass data from an email campaign into a form using query strings. For example, you might include a query string that identifies the specific campaign that led the recipient to the form. A hidden field in the form captures this data, helping you analyse performance and segment contacts.

To use query strings in your email campaign:

  1. Copy the direct URL of your published form.

  2. Add your query string to the end of the URL. For example, https://example.com/form?campaign_name=SeptemberLaunch.

  3. Paste the full URL into your email campaign using the Insert hyperlink option.
    Do not use the Link to a form option.

  4. Ensure your form has a hidden field that matches the key in your query string, such as campaign_name.

  5. Test the link to confirm the hidden field is populated correctly when the form is accessed.

You must use a direct URL to your form. The Link to a form option in the email editor doesn’t support query strings.


Best practices

  • Avoid spaces: Use underscores (_) instead of spaces.

  • Keep URLs readable: Use clear labels for keys.

  • Check data integrity: Ensure values match valid fields in Dotdigital.


Troubleshoot common issues

Problem 1
Spaces in query strings disrupt URL functionality.
Solution
Replace spaces with underscores or use encoding %20 to manage spaces appropriately.

Problem 2
Incorrect or missing form data due to improperly configured hidden fields. Solution
Double-check hidden field definitions within the form and ensure correct mapping with query strings in the URL.

See also:

Did this answer your question?