Skip to main content

URL Targeting

Control which pages display your Candu content using URL rules.

Deborah Ramírez avatar
Written by Deborah Ramírez
Updated this week

URL targeting controls which pages of your site can display your Candu content. Even if you have already defined where the content appears on the page with a selector and who should see it with a segment, the content will only load on pages that match your URL rules.

This guide covers how to set up URL rules, when to use wildcards for dynamic URLs, and how to test your targeting before publishing.

This article covers URL Targeting. If you need to personalize destination URLs in buttons or interactions using variables like {{userId}}, see the article on URL Templating.

When to use URL targeting

Use URL targeting when you need to:

  • Show content on specific pages only

  • Handle dynamic URLs where user IDs or other parts in the URL change (like app.candu.ai/users/12345/profile)

  • Separate test from production environments by targeting different domains or subdomains where Candu is installed

  • Control content visibility across multiple pages by setting up rules for related pages

For example, if you have the same selector across multiple pages but only want your content to appear on one specific page, URL targeting lets you couple your placement selector with URL matching to ensure content shows exactly where you intend.

Setting up URL Rules

You'll configure a URL when publishing your content or by editing placements in Settings > Placements:

  1. Enter the URL

  2. Choose where content appears:

    • On all pages
      Content will appear on every page where both your placement selector exists and Candu is installed.

    • On specific page(s)
      Set up URL rules to control exactly which pages display your content. This is the recommended approach for most use cases.

  3. Define "Match any or all rules":

    • Match ANY rule: Content appears if the page matches at least one rule (like an "OR" condition)

    • Match ALL rules: Content appears only if the page matches every rule (like an "AND" condition)

URL rule conditions

When setting up rules for specific pages, you can choose from these conditions:

Condition

What it matches

Example

URL exactly matches

The complete URL must match exactly

https://app.candu.ai/dashboard

URL contains

Any part of the URL contains the text

/settings matches app.candu.ai/settings, app.candu.ai/user/settings, etc.

URL does not contain

The URL must not include the text

Exclude /admin pages from showing content

URL starts with

The URL begins with the specified text

https://app.candu.ai/onboarding matches all onboarding pages

URL ends with

The URL finishes with the specified text

/complete matches all URLs ending in /complete

Wildcard

Replace variable parts of URLs with *

https://app.candu.ai/users/*/profile

Wildcards for dynamic URLs

Wildcards let you target pages where parts of the URL change, like user IDs, workspace numbers, or account names.

  • Use an asterisk (*) to replace any variable part of a URL:

Original: https://app.candu.ai/users/12345/profile

Wildcard: https://app.candu.ai/users/*/profile

This matches any user profile page, regardless of the user ID.

  • Multiple variables:

Original: https://app.candu.ai/workspaces/90/projects/78/reports

Wildcard: https://app.candu.ai/workspaces/*/projects/*/reports

This matches reports pages across all workspaces and projects.

  • Custom subdomains:

Original: https://acme-corp.app.candu.ai/dashboard

Wildcard: https://*.app.candu.ai/dashboard

This matches the dashboard across all customer subdomains.

  • Use an asterisk (**) to match across multiple segments in the path:

Wildcard: https://candu.ai/workspaces/**/reports

This will match:

/workspaces/90/78/reports

/workspaces/alpha/reports

/workspaces/anything/here/reports

  • Use a question mark (?) to match one single character.

Wildcard: https://candu.ai/workspaces/9?/reports

This matches /90/reports, /91/reports, etc.

When to use wildcards

Wildcards are essential when:

  • Your URLs include user IDs, account IDs, or workspace IDs that change for each user

  • You have customer-specific subdomains (like customer1.yourapp.com, customer2.yourapp.com)

  • You want the same content to appear across similar pages without creating dozens of individual rules

When NOT to use wildcards

Avoid wildcards when:

  • You can use "URL contains" or "URL starts with" instead

  • You're targeting a single specific page

  • Being overly broad could cause content to appear on unintended pages

💡 Tip: Start with more specific rules first. You can always expand to wildcards later if needed. It's easier to broaden targeting than to troubleshoot content appearing on the wrong pages.

Testing your URL rules

When setting up URL rules, you can paste any URL to test whether it matches your rules:

  1. In the URL rules section, look for the "Test a URL"

  2. Paste the full URL of a page where you want content to appear

  3. Candu will show whether that URL matches your current rules

Troubleshooting

Content is not showing on the expected page

  • Check workspace environment:

The most common issue is viewing content in a different workspace than where you built it. Open the Chrome Extension to verify the workspace shown matches where you created your content.

Your staging and production environments connect to different Candu workspaces, so content built in staging won't appear in production automatically. See the workspace guide for managing multiple environments.

  • Verify URL rules match:

Copy the full URL of the page where content should appear and follow these steps. If your URL doesn't match, look for typos, missing wildcards, or incorrect rule conditions.

  • Check "Match ANY" vs "Match ALL":

If you have multiple rules, verify you're using the correct matching logic. "Match ALL" requires every rule to be true, which can be overly restrictive.

Still not working? If you've followed this guide and are still experiencing issues, check the troubleshooting guide or reach out at [email protected] and we’ll be happy to help!

Did this answer your question?