---
title: Query string rule
slug: query-string-rule
description: How the Query string rule works in Personizely widgets: checking a URL parameter on the current page, operators, missing values and how it differs from targets.
docTags: 
createdAt: 2026-10-16T20:09:59.646Z
---

The Query string rule shows a widget only when a parameter in the current page's URL meets a condition, such as `utm_source` is `instagram` or `ref` is not empty. It looks at the URL of the page the visitor is on right now, which makes it a quick way to tie a widget to a specific link, ad or email.

**Available on:** all platforms.

## How it works

The rule reads **Query** *parameter* *operator* *value*. When a trigger fires, Personizely reads that parameter from the current page's URL and compares it.

For the URL `https://example.com/products/tee?utm_source=instagram&promo=`:

| Rule                                | Result                           |
| ----------------------------------- | -------------------------------- |
| Query `utm_source` is `instagram`   | Passes                           |
| Query `utm_source` contains `insta` | Passes                           |
| Query `promo` is empty              | Passes (present without a value) |
| Query `ref` is empty                | Passes (missing)                 |
| Query `ref` is not `email`          | Passes (missing counts as empty) |
| Query `UTM_SOURCE` is `instagram`   | Fails (names are case-sensitive) |

## Configuration

| Option   | What it does                                                      | Values / default                                                             |
| -------- | ----------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| Query    | The parameter name, as it appears in the URL                      | Text, e.g. `utm_source`                                                      |
| Operator | How the value is compared                                         | **is** (default), is not, contains, does not contain, is empty, is not empty |
| Value    | The value to compare with (not shown for is empty / is not empty) | Text                                                                         |

## Behavior details and limitations

- **Only the current URL counts.** The rule doesn't remember parameters from earlier pages. A visitor who arrived with `?utm_source=instagram` and then opened another page no longer passes, unless the parameter is in that page's URL too. To remember parameters across pages and visits, use a [Target rule](docId\:lKIsRCLhPiFzzx8QqEhXw) with the [Query string filter](docId\:imJz2jaBT2xMGXv_rRXTQ) or UTM filter.
- **Missing equals empty.** A parameter that isn't in the URL is treated as an empty value, so "is not", "does not contain" and "is empty" pass when it's missing.
- **Case-sensitive.** Both the parameter name and the value comparison are case-sensitive.
- **Decoded values.** Values are compared after URL decoding: `?q=summer%20sale` and `?q=summer+sale` both equal `summer sale`.
- **Repeated parameters.** If a parameter appears more than once, the first value is used.
- **Checked when a trigger fires.** On single-page apps, that's the URL at the moment the trigger fires.

## Examples

- **Instagram welcome offer:** Query `utm_source` is `instagram`, with a Landing trigger.
- **Hide on email traffic:** Query `utm_medium` is not `email`, so subscribers don't get a signup popup.
- **Influencer links:** Query `ref` is not empty, with a popup that greets referred visitors.

## Troubleshooting

- **Widget shows on the landing page but not on the next page** → expected: the rule only reads the current URL. Use a Target with the Query string filter.
- **Rule never passes** → the parameter name's case differs, or the value is encoded differently from what you typed.

## Related

- [Widget display rules](docId\:mlu6RMShG5Lchdu651dv7)
- [Pages rule](docId\:p-JMOkPIWtuHGWw480BC0)
- [Query string filter](docId\:imJz2jaBT2xMGXv_rRXTQ)
- [Dynamic text (personalization variables)](docId\:EEz3US75criNjfndB--uS)
