How To Target Optins To URLs With Query Strings (UTM Parameters)
With MailOptin, you can target your opt-in campaigns to visitors based on the query strings present in the page’s URL such as UTM parameters.
As a result, you can ask people linking to you to include a certain query string in the link and then target a specific opt-in form to them.
This guide shows you how to set-up query string targeting.
What is a query string
A query string is the part of a URL that appears after a question mark.
For example, in the following URL:
The query string is
action=view-comment where “action” is the name of the query string and “view-comment” is the value.
Targeting campaigns using query strings
There are two ways to target your MailOptin campaigns using query strings:
- Hiding all campaigns using the global
- Only showing or hiding campaigns on pages containing query strings that you specify.
Hiding all campaigns using the global
mohide=true query string
When a visitor visits a page that contains the query string
mohide=true, no opt-in campaign will be shown to them.
For example, if in your email newsletter, you are linking to a landing page of your website with URL
https://mailoptin.io/lead-generation-wordpress/, adding “mohide=true” query string like so
https://mailoptin.io/lead-generation-wordpress/?mohide=true will hide all optin forms that would have been shown on the page.
If you want all your optin campaigns to also be hidden from your subscribers who click links to your website that contains the query string
mohide=truewhen they visit other pages of your site; ensure you’ve set a global success cookie. By doing this, subscribers won’t see your optins until the number of days set in global success cookie is over.
Also, say the landing page has an existing query string you want to preserve (such as
https://mailoptin.io/lead-generation-wordpress/?ref=21) yet, still want to implement mohide=true so all optin campaigns are not shown, you can achieve this by replace using an ampersand instead of a question mark like so
https://mailoptin.io/lead-generation-wordpress/?ref=21&mohide=true because a URL can only have a single question mark which indicate the start of query strings.
Show or hide campaigns on pages containing specific query strings
To give you complete control of how your opt-in campaigns are targeted, MailOptin allows you to specify your own query strings for each campaign you create.
You can also choose whether the form should be displayed or hidden if a user visits a page with the query string you provide.
To do this:
- Locate the opt-in campaign that you want to target and then click on the blue pen icon to open the opt-in form customizer panel.
- Click on the display rules panel to open the display rules editor as shown below.
- Then click on the query string targeting panel to edit it.
- In this panel, you will be able to specify the query string and the action that should be taken if a visitor visits a page that matches the query string.
Here is an explanation of the fields:
You can specify whether to hide or only show the opt-in campaign on pages that match the query string you specify.
Please note that if you do not select an action then the query string will be ignored.
Query String Name
This is the name that appears before the
In the global query string
mohide is the name of the query string while
true is the value.
Query String Value
This is optional. If you leave it empty, the query string will always match as long as the query string name matches irrespective of the value of the query string value.
You can specify it to only target pages whose query string value matches the value you specify.
Let us know if you have any question.