Article Table of Contents
- Set a Targeting Condition
- Modify a Targeting Condition
As described in the article 'Targeting' option settings, the 'Popup Settings' -> 'Targeting' tab allows plugin users to accept or change the conditions when a popup will display. Targeting conditions prepare a popup to display by preloading them in the browser on page load ( also known as 'activation' ). When a popup is activated in the browser, it can be evaluated by a popup trigger, which along with site visitor behavior controls the popup display.
Popup targeting conditions are set in one of two ways:
- Always On ( plugin default ): By default, the plugin preloads a published popup in the browser on every page and post of a site. This ensures that whichever popup trigger is selected in the Popup Editor, a popup will always be ready to display in the browser. When a plugin user accepts the default targeting settings, the plugin activates a popup to appear on the largest possible set of published posts and pages.
- Targeted: The plugin user chooses a select set of conditions that targets the posts and/or pages on which a popup will activate.
This article explains how to set specific, content-based targeting conditions using the plugin's default standard targeting conditions. Additional targeting conditions specific to the WooCommerce or BuddyPress plugins become available when those plugins are activated with Popup Maker.
Non-content-based targeting conditions are available by installing the Advanced Targeting Conditions (ATC) plugin extension to Popup Maker.
Related index page: Advanced Targeting Conditions Introduction
Related article: WooCommerce Conditions
Related article: BuddyPress Conditions
Set A Targeting Condition
Add a Condition with the Targeting Selector
To target either a segment of your site content, or specific non-content-based conditions for popup activation, use the drop-down menu selector at 'Popup Settings' -> 'Targeting' (identified by the purple arrow above). This selector menu offers all of the plugin's standard (content-based) targeting conditions, plus any additional conditions provided by other plugins ( Popup Maker's Advanced Targeting Conditions extension, WooCommerce, etc ).
Target a Single Condition ( Simplest Use Case )
Targeting conditions are simply conditional sentences using 'if' and 'then' clauses. When the 'if' clause is true, a specific result is expected. The following sentence contains an 'if/then' clause that refers to a single published page.
If a visitor opens a published page with the title 'Our Services', then activate the popup named 'Newsletter Signup'.
In the Popup Editor, the single targeting condition described above is shown in the following screenshot:
Target Two or More Conditions
Most plugin users however typically target two or more elements within the same content type for popup activation. Examples could include:
- two or more pages (selected by page title),
- two or more posts (selected by post title or ID number), or
- two or more post categories.
Or they target two or more conditions that mix standard and advanced targeting conditions.
How should those targeting conditions be setup in the Popup Editor?
Target Using an 'OR' Operator
Use the 'OR' operator to target the largest set of possible conditions for popup activation.
When targeting two or more conditions, select the 'OR' operator to link each condition. An 'OR' operator requires that only one of the conditions be true at any one time to return the intended result. Additional 'OR' conditions can be added in 'Popup Settings' -> 'Targeting' by simply clicking on the term '+ OR'.
In the following example, two content types are targeted to activate a popup:
- 'Page: Selected' -> 'Our Services', or
- 'Post: Selected' -> 'Choosing a Contractor'.
A conditional statement targeting this content could be written as:
If a visitor opens a published page with the title 'Our Services' OR a published post with the title 'Choosing a Contractor', then activate a popup named 'Newsletter Signup'.
The logic of this statement makes sense. When either the page 'Our Services' OR the post 'Choosing a Contractor' appears in the browser, the popup will activate.
In the Popup Editor, the targeting conditions are shown in the following screenshot:
As a second example, let's change the post 'Choosing a Contractor' to a 'page' content type. Now two pages ( 'Our Services' and 'Choosing a Contractor' ) are targeted, and can be stated in the same conditions field. The targeting condition implies the use of an 'OR' operator. If either page, 'Our Services' OR 'Choosing A Contractor' is opened in the browser (returns TRUE), a popup will activate.
The same targeting condition could be set in the Popup Editor using an explicit 'OR' operator as shown in the screenshot below.
Both targeting conditions are equivalent.
Tip: When setting 3 or more conditions that include the same content type, use an 'OR' operator to separately state each condition. It's easier to read, and can assist with troubleshooting should a problem later arise with a popup.
Target Using an 'AND' Operator
Use the 'AND' operator to target the fewest set of possible conditions for popup activation.
The 'AND' operator links two or more conditions together to require that each condition be true to activate a popup. Stated another way, if any condition linked by an 'AND' operator is false, the popup will not activate. An 'AND' condition can be added in 'Popup Settings' -> 'Targeting' by simply clicking on the term '+ AND'.
'AND' operators are typically used with:
- a combination of standard and advanced targeting conditions; and
- a combination of negative and positive conditions.
Plugins users sometimes report difficulty activating a popup with multiple conditions linked with an 'AND' operator. This often occurs when targeting a mixture of different content types, such as:
- a page and a post; or
- a page and post category, or
- a page and an image (attachment).
Consider the logic behind the first example in the above list; a page and a post must both be true. Expressed in a statement:
If the 'Home Page' and a post with the title 'Our Services' are viewed in the browser at the same time, then activate a popup named 'Newsletter Signup'.
Such a situation is impossible! One cannot view the 'Home Page' and any other page (whether page or post) at the same time. Since the situation does not occur, the popup will not activate.
If a popup does not activate when targeting multiple conditions, examine the conditions operator in use. Chances are that by changing from an 'AND' to an 'OR' operator, your popup is more likely to activate.
Set a Negative (Opposite) Condition
By default, Popup Maker assigns all targeting conditions as positive statements. If a user targets the condition 'Page: Selected' -> 'Home', the popup will activate on 'Home'.
Sometimes users need to exclude or return the opposite of a stated value. To declare a negative (NOT) condition, click the (!) button located to the left of the targeting selector. When a negative condition is activate, the grey button background turns red and the popup returns the opposite of what is selected.
In the screenshot example above, the page named 'Home' is selected. The negative condition returns the opposite value. The plugin will activate the popup to display on all pages except the 'Home' page.
When using the Advanced Targeting Conditions (ATC) plugin extension, users sometimes wish to display a popup only to site visitors who are not logged in. The ATC extension provides a condition 'User: Is Logged In'. To target the opposite value (user is not logged in), select the NOT operator to the left of the targeting selector. Now the popup will be activated only for site visitors not logged into the site.
Modify a Targeting Condition
Edit a Targeting Selector
Change a condition within a selector by choosing from the available drop-down menu options.
Delete a Targeting Selector
To remove a targeting condition, click the (X) icon to the right of the box.
Disable a Popup on Mobile and/or Tablet Devices
By default, the base (free) version of Popup Maker will display a popup on desktop, tablet, and mobile device screens. Popups can be disabled on all mobile and/or tablet devices by selecting the checkboxes located beneath the targeting option selector.
Note: To display a popup only on a mobile or tablet device ( and prevent it's display on a desktop screen ) requires the installation of the Advanced Targeting Conditions plugin extension to Popup Maker .
Add a Custom Targeting Condition
Popup Maker provides a filter 'pum_registered_conditions' to add a custom targeting condition to a popup. The filter is located at '/popup-maker/classes/Conditions.php' in the function 'register_conditions()' on line 434.
Refer to the related article link below in our developer documentation for examples of how to add custom conditions to the plugin.
Related article: Add a Custom Popup Condition