# Using Wildcard URL Patterns

When configuring Spara features that target specific pages on your website (like preview messages), you don't need to add every URL individually. Wildcard patterns let you target entire sections of your site with a single entry.

## How wildcards work

Add `/*` to the end of a URL path to match that path and all pages beneath it. Spara uses simple path prefix matching, not regular expressions.

| Pattern       | What it matches                                                  |
| ------------- | ---------------------------------------------------------------- |
| `/blog/*`     | `/blog`, `/blog/my-post`, `/blog/2026/april/update`              |
| `/products/*` | `/products`, `/products/enterprise`, `/products/pricing/details` |
| `/docs/*`     | `/docs`, `/docs/getting-started`, `/docs/api/reference`          |
| `/*`          | Every page on your site                                          |
| `/pricing`    | Only `/pricing` (exact match, no wildcard)                       |

You can also include the full domain to restrict matching to a specific subdomain:

| Pattern                          | What it matches                      |
| -------------------------------- | ------------------------------------ |
| `https://www.example.com/blog/*` | Only blog pages on `www.example.com` |
| `https://docs.example.com/*`     | All pages on `docs.example.com`      |

{% hint style="info" %}
Trailing slashes are ignored when matching. `/blog` and `/blog/` are treated as the same path.
{% endhint %}

## Where wildcards are used

### Preview messages

Preview messages (the pop-up message that appears when a lead visits a page) can be targeted to specific URLs using the **criteria** field. Set the criteria variable to `current_url` and the value to a wildcard pattern like `/blog/*` to show a customized preview message on all blog pages.

For more on preview messages, see [https://docs.spara.com/agents/chat-agents](https://docs.spara.com/agents/chat-agents "mention").

## Example: Different previews for different sections

You might configure three previews for your Navigator chat agent:

1. **Product pages** (`/products/*`) — "Want to see how this works for your team? Let's chat."
2. **Blog pages** (`/blog/*`) — "Have questions about this topic? I can help."
3. **Default** (no criteria) — "Hi there! How can I help you today?"

Spara evaluates previews in order. The first preview whose criteria matches the lead's current URL is shown. The default preview (with no criteria) acts as a catch-all for pages that don't match any other pattern.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spara.com/guides/platform-guides/using-wildcard-url-patterns.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
