Display WordPress Optin & Message To URLs With Query Strings (UTM Parameters)

Do you want to take your WordPress optin campaigns to the next level by targeting visitors based on specific query strings in the page’s URL?

With MailOptin, you can precisely target your WordPress optin forms and message to engage your audience based on their unique URL parameters or query strings in the page’s URL, such as UTM parameters.

This guide shows you how to set up query string targeting of optin campaigns in MailOptin on your WordPress website.

What is a Query String?

A query string is a part of a URL that contains data to be passed to web applications. It typically appears after the question mark (?) in a URL and consists of key-value pairs separated by an ampersand (&).

Query strings are commonly used to pass parameters and values to web pages and applications for various purposes, such as tracking user behavior, filtering data, or handling form submissions.

For example, in the following URL:

https://mailoptin.io/blog/hello-world?action=view-comment

The query string is action=view-comment where “action” is the name of the query string and “view-comment” is the value.

Targeting Optin Campaigns Using Query Strings

There are two ways to target your MailOptin campaigns using query strings:

  • Hiding all campaigns using the global mohide=true query string.
  • 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 a URL https://mailoptin.io/lead-generation-wordpress/, adding a “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 also to be hidden from your subscribers who click links to your website that contain 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 the global success cookie is over.

Say the landing page has an existing query string you want to preserve (such as https://mailoptin.io/lead-generation-wordpress/?ref=21) but still want to implement mohide=true so all optin campaigns are not shown; you can achieve this by 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 indicates 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 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:

  1. Locate the optin campaign you want to target and then click on the blue pen icon to open the opt-in form customizer panel.
  2. Click on the display rules panel to open the display rules editor, as shown below.
  3. Then click on the query string targeting panel to edit it.
  4. In this panel, you can 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:

Action

You can specify whether to hide or only show the WordPress optin campaign on pages matching your query string.

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 = sign.

In the global query string mohide=true , 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 your specified value.

 

 

We hope this article has helped guide you through targeting opt-in campaigns to URLs with query strings. Also, check out our guide on targeting visitors from platforms like Facebook and Google.