Skip to main content
Dynamic URLs

Load your Candu content dynamically depending on the page URL within your application.

Flora Sanders avatar
Written by Flora Sanders
Updated over 4 months ago

Dynamic URLs

Candu supports products that have dynamic URLs for both:

  • Directing users to certain pages/URLs in your product from CTAs

  • Targeting where content needs to be embedded

An example of a dynamic URL where the path or format changes depending on the user or account: https://candu.ai/workspaces/678/22

The 678 refers to the unique 'UserID' and 22 to the unique 'OrgID' which are both portions of the URL path that will change depending on the customer or user. The rest of the URL will remain the same.


Directing users to certain pages/URLs in your product from CTAs

In order to ensure that users are directed to the appropriate sections of your product, you can leverage dynamic URLs. This allows you to replace variable parts of a URL with specific User Traits that you send through to Candu (similar to Variables). This method eliminates the need to create separate content experiences for certain use cases, streamlining your content management.

Example Scenario

You store data in different regions with distinct URL structures, such as eu.companyname.com for Europe and us.companyname.com for the United States. To direct users to the correct URL based on their region without creating separate content experiences:

  1. Ensure you are sending the Region as a User Trait to Candu (e.g., 'eu' or 'us').

  2. Format your URL to include the User Trait in place of the variable part. Enclose the trait name within double curly brackets ({{}})and put user. before the trait name. For example, to include a region:

3. If you want to provide a default value in case the User Trait is not available, use a pipe (|) followed by the fallback value. This ensures that if the region trait in this example, is not provided, 'us' will be used by default.


Using Relative URLs

When directing users within the same domain or subdomain, relative URLs provide a convenient way to navigate to different sections. They are particularly useful when the structure of the URL remains consistent, but specific path segments may vary:

Example Scenario

  1. Consider a URL structure like https://candu.ai/workspaces/679/23/billing, where 679 represents the workspace ID, 23 represents the user ID, and billing represents a specific section.

  2. To navigate to another section of the product (analytics, for example) within the same domain (candu.ai), you can use relative URLs ./analytics. This URL would navigate to https://candu.ai/workspaces/679/23/analytics, maintaining the candu.ai domain and adjusting the path segment (analytics) while adjusting the workspace ID and user ID as needed.

Limitations

  • Cross-Domain Navigation: Relative URLs cannot navigate to entirely different domains (e.g., anotherdomain.com).

  • Variable Subdomains: If your application uses variable subdomains (e.g., eu.candu.ai vs. us.candu.ai), relative URLs are not suitable. Dynamic URLs with placeholders for subdomains (https://{{user.subdomain}}.candu.ai) would be required.


Targeting where content needs to be embedded - Wildcard URLs

Wildcard URLs provide a way for you to load your Candu content dynamically, depending on the page URL.

You can simply replace the variable parts of a URL with an asterisk (*), also known as a wildcard. By adding in an *, you are telling Candu that you want the URL matching to allow that part of the URL to be variable.

When replacing the 'userid' and 'org' portions of the above example URL with an *, the URL will appear as follows: https://candu.ai/workspaces/**

Another example is when an application offers a different URL per customer such as:

companyname.candu.ai

You can add a wildcard for this use case: *.candu.ai

Setting up Wildcard URLs

The process is the same as adding a standard URL Embed apart from the format of the URLs entered.

Setting up Wildcard URLs from the placements tab:

For Inline experiences:

For Overlays:

For Hotspots:

Setting up Wildcard URLs from the Chrome Extension:

⚠️ Please note you cannot test wildcard URLs in preview mode prior to content actually being embedded. We recommend embedding content in a staging environment or creating an 'Only Me' segment for testing purposes.

Did this answer your question?