How to retarget visitors who saw a specific page on your website

Lisa Fockens Updated by Lisa Fockens

Do you want to display a popup to the visitors who saw page X on your website? In this article, we'll explain how, using custom properties.

Retarget the visitors of one unique page

Step 1: Add the script

Paste the following script right before the </script> tag of your Wisepops setup code.

if (window.location.pathname === '/path/to/pageX/') {
    wisepops('properties', {
        pageX: new Date()

Replace 'path' with the path of your own page.


You can also replace pageX with any name you'd like.

Here's an example using our own website. We want to retarget the users who saw our pricing page. The URL of this page is:

This is what the script will look like for me:

if (window.location.pathname === '/pricing/') {
    wisepops('properties', {
        PricingPage: new Date()

And this is what the result will look like in Google Tag Manager:

Check this guide to help you test the custom property.

Step 2: Add a condition to your display scenario

Open your popup in the Wisepops builder.

In the left menu, click Display and then select Custom properties.

Click Add rule, paste the name of your page and select the condition Exists.

For me, the condition would look like this:

You can also adjust the time frame. For example, I could display the popup to the visitors who visited our pricing page more than 14 days ago.

Retarget the visitors of two or more pages

You can also adapt the script to target multiple pages, like this:

if (window.location.pathname === '/path/to/pageX') {
    wisepops('properties', {
        pageX: new Date()
} else if (window.location.pathname === '/path/to/pageY') {
    wisepops('properties', {
        pageY: new Date()

Need some help? Get in touch with our team via chat and we will help you.

How to Target (or Exclude) Visitors Who Have Seen a Specific URL

Display a Popup Based on an Alexa Rank Condition (With Clearbit)