Dynamic inputs

Dynamic inputs enable flexible, data-driven routing by allowing you to capture values from URLs and pass them to compositions. This includes dynamic path segments (like product IDs), query strings (like search parameters), and locale nodes for internationalization.

Dynamic inputs are values captured from the URL that are passed to compositions attached to project map nodes. These values can be used to:

  • Fetch specific content from external systems based on URL parameters
  • Apply conditional logic to show/hide components or change values
  • Create reusable compositions that adapt to different URL patterns
  • Support internationalized routing with locale-specific URLs

There are three types of dynamic inputs:

  1. Dynamic path segments: Capture variable parts of the URL path (e.g., /products/:productId)
  2. Query strings: Capture URL query parameters (e.g., ?region=us-west&customerType=premium)
  3. Locale nodes: Special dynamic segments that represent locale codes for internationalization

Dynamic path segments allow project map to resolve any value for one segment in a URL. Given a dynamic node path such as /:lang/products/:productId, this would resolve to the :productId project map node for values such as /en/products/32 and /uk/products/awesome.

Once the route is matched, the specific dynamic values are passed to the composition and resolve to external data.

  1. Navigate to Experience > Project Map and add a node by either clicking the Add node button, the within your project map, or the within your project map and select an option to add a node.
  2. Select Dynamic under "Path segment" to create a dynamic path.
  3. Enter a name for the dynamic segment (e.g., productId, slug, category).
  4. Configure the attached composition and other node settings.
  5. Save the node.
add-node-dynamic
Configuring a dynamic path segment

Dynamic path segments are available as dynamic inputs in compositions attached to the node. You can use them to:

Learn how to create compositions for dynamic routes.

Query strings (also called query parameters) enable specific query string values to be collected from the URL and passed to the Route API to be made available to compositions. These are useful for tasks such as regional targeting, customer segmentation, campaign tracking, and other cases where a path might have more than one value.

When you define a query string, you specify that it is an allowed query string parameter for the Route API. It is not required to be present in the URL, but if it is, it will be passed to the composition as a dynamic input. Any other query strings will be ignored by the Route API.

Query strings can be defined in two ways:

Global query strings are configured once at the project map level in Settings > Project Map and automatically available to all project map nodes. Use these for query strings that are consistent across your site (e.g., utm_campaign, utm_source, region, customerType).

Benefits:

  • Configure once, automatically available to all nodes
  • Can be used in component and composition patterns for conditional logic and data resources
  • Ensure consistency in query string naming, default values and predefined options across your project

note

If a query string is set up globally at the project level, you can't add another query string with the same name to individual nodes. In case of a conflict, the global query string is used.

Learn how to configure global query strings.

Node-specific query strings are set up individually on project map nodes for cases where a query string is needed only for a particular route. You can add node-specific query strings while managing your project map nodes.

You can define predefined options for both global and node-specific query strings. This lets you present authors with a dropdown menu listing the allowed values when previewing in the visual editor. Authors must pick from these options instead of typing values manually.

global-query-string-add
Global query string with predefined options

Default values vs preview values

Query strings have a default value which is used when the query parameter isn't passed in the URL. This is different from the preview value of a dynamic path segment that only applies when previewing the composition in the visual editor.

Locale nodes are special dynamic path segments that capture the locale code from the URL. They enable internationalized routing by allowing a single dynamic segment to represent any configured locale.

For example, a locale node at /:locale in your project map will match /en-US, /de-DE, /fr-FR, etc., and pass the locale value to compositions as a dynamic input.

Locale nodes are a specialized type of dynamic path segment configured in the project map. When the Route API resolves a URL with a locale node:

  1. The locale value is extracted from the URL path
  2. The locale is validated against your project's configured locales
  3. The locale is passed to the composition and used for locale resolution
  4. The composition is returned in the requested locale if available

To configure a locale node:

  1. Navigate to Experience > Project Map and add a node
  2. Select Locale under "Path segment"
  3. Configure the attached composition and other node settings
  4. Save the node

Learn more about using locale nodes for locale resolution in the localization guide.

Dynamic inputs can be used in several ways within compositions:

Use dynamic inputs to fetch specific content from external systems by connecting them to data resource variables. For example, use a productId path segment to fetch product data, or a q query string to perform a search.

Use dynamic inputs in conditional logic to:

Using dynamic inputs in patterns

Global query strings can be leveraged within component and composition patterns to drive conditional logic and provide data to data resources. By doing so, you increase the reusability and flexibility of patterns, allowing them to adapt dynamically based on URL parameters.