OptinMonster makes it easy to show or hide campaigns to visitors on your site based on the query arguments in the URL.
In this article, you’ll learn how to target campaigns to URLs with query arguments.
Before you start, this feature is available with a Pro and higher subscription.
Query argument is a specific portion of a web page’s URL, but not the full URL. The query argument comes after a question mark and before any anchors.
A URL can contain multiple sets of query arguments, separated by an ampersand like this: http://domain.com/?key=value&key2=value2&key3=value3
The term “query argument” is also sometimes called “query string” or “query parameters”.
The query argument rule is case-sensitive.
Query Argument Targeting
When you create a campaign in OptinMonster you can target URLs on your site that contain certain query arguments.
To show or hide your campaign on URLs with query arguments, follow these steps:
- Navigate to the Display Rules view in the campaign builder.
- Next, when adding or editing a rule select Where (Targeting) from the left-hand list and select the Query Targeting option.
- Finally, enter the name of the key and value, if you’re doing any type of matching, into the provided fields.
You’ll have the following match options available:- Key only:
- exists
- does not exist
- is empty (no query args)
- is not empty (has query args)
- Value only:
- empty
- not empty
- is empty
- is not empty
- Key and Value:
- exactly matches
- does not exactly match
- contains
- does not contain
- starts with
- does not start with
- ends with
- does not end with
- is anything
- matches the pattern
- Key only:
- When you’re finished, Save the campaign.
Examples
Here are some examples to help you get started.
Marketing Campaign
If you run a marketing campaign like Google Adwords or an Email Campaign, each URL will contain UTM Parameters you can target. Our guide here shows how you can target campaigns to your pay-per-click marketing campaigns.
E-Commerce
If your e-commerce platform uses query arguments in the URL to add products to the shopping cart you could show a specific campaign when a visitor adds a specific product to their cart.
Let’s assume your e-commerce site uses a query argument structure like the following to add a product to the shopping cart:
http://www.example.com/checkout/?add-to-cart=532
The URL has one query argument key and one query argument value:
Key: add-to-cart
Value: 532
When the above URL is visited on our example e-commerce store, the product with ID 532 is automatically added to the visitor’s shopping cart.
Now, we can target a campaign to show only when a URL with that query argument is visited. Perhaps we want to offer a specific upsell in the campaign when the product with ID 532 is added to the cart.
To do this, we’ll add a query arg rule to the Display Rules and enter the key and value with exactly matches condition.
Site Search
Some websites will use query arguments in the URL to generate search results. If your website follows this convention you can use query argument targeting to show a specific campaign to visitors who search for a certain term.
For most websites, the query string for searches will look similar to the following:
https://optinmonster.com/?s=content+upgrades
For the URL above, there is one query argument key and one query argument value.
Key: s
Value: content+upgrades
*The plus (+) sign typically represents a space between search terms since a URL cannot contain spaces.
Now, we can target a campaign to show only when a URL with that query argument is visited. This may be a good opportunity to show a campaign that offers a free ebook related to content upgrades.
To do this, we’ll add a query arg rule to the Display Rules and enter the key and value with exactly matches condition.
FAQs
Is this rule case-sensitive?
Yes, all operator conditions for the query argument rule are case-sensitive.
For example, the query argument key of ‘Hello’ is not the same as ‘hello’.
Be sure to check the case of your query arguments to be sure the Display Rule configured matches.
If you’re serious about jumpstarting your website business growth, then get started with OptinMonster today!
Get Started With OptinMonster Today!BONUS: Done-For-You Campaign Setup ($297 value)
Our conversion experts will design 1 free campaign for you to get maximum results – absolutely FREE!
Click here to get started →