> For the complete documentation index, see [llms.txt](https://docs.userlane.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.userlane.com/assistance/content-operations/targeting.md).

# Targeting

How to control which users see a piece of content and on which pages it appears, using audiences and page rules.

Targeting controls two things: which users see a piece of content, and on which pages that content appears. You can narrow every content type in Userlane to the right people on the right pages before it goes live, so users only see what is relevant to them.

Audiences[^1] handle the "who," and page rules[^2] handle the "where." You create both on the **Targeting** page in the portal and then apply them to individual content items. When no targeting is applied, content appears for all users on all pages of the application.

## Create a page rule

A page rule restricts content to specific pages in the application based on the URL. You define a URL pattern, and Userlane shows (or hides) content only on pages whose URL matches it.

<div data-with-frame="true"><figure><img src="https://259567114-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FF6bxg8i3T6U4vZ3k7PHi%2Fuploads%2FVx4ptXJjS6UALcuA4xUz%2Ftargeting.png?alt=media&#x26;token=5b47bbac-2ffc-4149-b683-e5d4881c3db4" alt="The Targeting page in the Userlane portal"><figcaption><p>The Targeting page, where page rules and audiences are created.</p></figcaption></figure></div>

{% stepper %}
{% step %}

#### Open the Targeting page

In the left navigation, under **Assistance**, select **Targeting**.
{% endstep %}

{% step %}

#### Start a new page rule

Select **Add Page Rule**. The page rule creation form opens.
{% endstep %}

{% step %}

#### Name the page rule

Enter a descriptive name in the **Page Rule Name** field. Choose something that makes the rule easy to identify later, such as "Profile section" or "Login page exclusion."
{% endstep %}

{% step %}

#### Choose whether to show or hide content

The **Show On** option is selected by default, which means content appears only on pages matching the URL pattern. To hide content on matching pages instead, switch the dropdown to **Do Not Show On**.
{% endstep %}

{% step %}

#### Enter the URL pattern

In the field labeled **Insert unique part of URL here**, type the part of the URL you want to match. There are three ways to define a pattern, depending on how your application is set up:

* **Path only** works well when all users are on a single domain. Enter the distinctive path segment of the page, for example `/targeting` or `users/list`. Userlane matches this against any URL that contains that path.
* **Subdomain + domain + path** is useful when the application spans subdomains and you need to be specific. For example, `test.mycompany.com/users` matches only that combination.
* **Subdomain + domain only** targets an entire subdomain without narrowing to a specific path. For example, `customer-id.mycompany.com` matches every page on that subdomain.

Use a wildcard[^3] (`*`) to match varying parts of a subdomain or path. For example, `*.mycompany.com` matches any subdomain, and `users/*/profile` matches any value in the middle segment.
{% endstep %}

{% step %}

#### Add more conditions if needed

To match several URL patterns, select the **+** button and enter another pattern. Content appears on pages that match any of the listed patterns.
{% endstep %}

{% step %}

#### Save the page rule

Select **Save**. The page rule appears in the table on the **Targeting** page, ready to be applied to content.
{% endstep %}
{% endstepper %}

## URL matching rules

Most surprises with page rules, such as content showing on the wrong page or not showing at all, come down to how the pattern is matched. The table below sets out each rule.

<table><thead><tr><th width="156.2890625">Rule</th><th>How it works</th></tr></thead><tbody><tr><td>Path only (no domain)</td><td>Partial match. The content appears on any page whose URL contains the path segment. For example, <code>users/list</code> matches <code>mycompany.com/users/list</code> and <code>test.mycompany.com/app/users/list</code>.</td></tr><tr><td>Domain + path</td><td>Full match. The subdomain, domain, domain suffix, and path must all match. For example, <code>test.mycompany.com/users</code> does not match <code>staging.mycompany.com/users</code>.</td></tr><tr><td>Wildcards</td><td>Supported in subdomains (<code>*.mycompany.com</code>) and path parameters (<code>users/*/profile</code>). Not supported in domain names or domain suffixes.</td></tr><tr><td>Protocol and port</td><td>Ignored. <code>https://</code>, <code>http://</code>, and port numbers like <code>:443</code> have no effect on matching.</td></tr><tr><td>IP addresses</td><td>Ignored. If a user accesses the application by IP address, the page rule passes by default.</td></tr><tr><td>Multiple conditions</td><td>Connected with OR logic using the <strong>+</strong> button. Content appears if any condition matches.</td></tr></tbody></table>

## Create an audience

Audiences are also created from the **Targeting** page. Select **Add Audience** to open the audience builder, where you define conditions based on user attributes, behavior, or guide interactions.

Building an audience involves choosing conditions, setting operators, and testing who matches. For the full walkthrough, go to [Build an audience from attribute rules](/administration/audiences/build-an-audience-from-attribute-rules.md).

## Where targeting is applied

Audiences and page rules are created centrally on the **Targeting** page, but you apply them from each content type's own settings. When you edit a guide, announcement, tooltip, or validator, you choose which audiences and page rules apply to that item.

{% hint style="info" %}
**Chapters and guides.** Applying an audience or page rule to a chapter affects every guide in that chapter. Targeting on a single guide within a chapter adds conditions on top of the chapter-level targeting, because the two combine with AND logic.
{% endhint %}

## How targeting conditions combine

When both an audience and a page rule are applied to the same content item, both must match for the content to appear. A guide targeted at a "Sales team" audience and restricted to the `/opportunities` path only shows when a member of that team is on an Opportunities page.

Chapter-level and guide-level targeting stack the same way. If a chapter is restricted to an audience and a guide within it has its own page rule, a user must satisfy both. Guide-level targeting can therefore narrow the reach, but it can never widen it beyond what the chapter allows.

Targeting also shapes what appears in the Assistant. The guide count on the Assistant badge reflects the targeting active on the current page, and if every guide in a chapter is restricted to other pages, the chapter disappears from the Assistant on that page.

## Relevant articles

{% content-ref url="/pages/TKBRGmMaapWk0xuF3XwG" %}
[Audiences](/administration/audiences.md)
{% endcontent-ref %}

{% content-ref url="/pages/Zk1PSRimln0YLI1l2ZkI" %}
[Build an audience from attribute rules](/administration/audiences/build-an-audience-from-attribute-rules.md)
{% endcontent-ref %}

{% content-ref url="/pages/1S0Ysrf45iMPMs4rp5yk" %}
[Creating guides](/assistance/in-app-guidance/creating-guides.md)
{% endcontent-ref %}

{% content-ref url="/pages/XDGntxUJimFOtJOihyow" %}
[The Assistant](/assistance/the-assistant.md)
{% endcontent-ref %}

## FAQ

<details>

<summary>Can page rules filter analytics?</summary>

No. Page rules control content visibility only. To filter analytics by user group, use audiences in the analytics views. Page rules have no effect on what data is collected or how it is displayed in reports.

</details>

<details>

<summary>What happens when both chapter-level and guide-level targeting are set?</summary>

Both conditions apply with AND logic. The guide appears only when the chapter-level conditions and the guide-level conditions are both met. Guide-level targeting narrows the reach further but cannot override the chapter-level restriction.

</details>

<details>

<summary>Do page rules affect the Userlane Assistant?</summary>

Yes. The Assistant adjusts the guide list and the badge count based on which page the user is currently on. Guides restricted to other pages by a page rule do not appear in the Assistant on the current page.

</details>

<details>

<summary>Can wildcards be used in domain names?</summary>

No. Wildcards work only in subdomains and path parameters. For example, `*.mycompany.com` is valid because the wildcard is in the subdomain, but `my*.com` is not valid because the wildcard is in the domain name.

</details>

<details>

<summary>What is the difference between Show On and Do Not Show On?</summary>

**Show On** displays content only on pages matching the URL pattern. **Do Not Show On** hides content on matching pages and shows it everywhere else. Choose **Do Not Show On** when it is easier to define where content should not appear, such as excluding a login page.

</details>

[^1]: An audience is a reusable group of users defined by attribute rules. Audiences are used for both content targeting and analytics filtering. Audiences were previously called user segments.

[^2]: A page rule is a URL-based condition that controls which pages in the application a piece of content appears on. Page rules were previously called page segments.

[^3]: A wildcard is an asterisk (`*`) used as a placeholder in a URL pattern to match any value in that position.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.userlane.com/assistance/content-operations/targeting.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
