Number of Page Visits-Based Adaptive Content

In this example, we will explain how to display a sequence of different content versions based on the number of times the user has visited a certain page.

If you want to display dynamic content based on the number of visits on any page on the site, you can use the Returning Visitor condition.

Creating a sequence of content using the Cookie Condition

The idea is simple. To create the sequence of content, we will add a cookie when the user visits the page for the first time and set dynamic content using the cookie condition so that if the cookie exists in the users’ browser on the next visit, they will see the dynamic content.

Step-by-step guide

  1. On your WordPress dashboard, go to “If>So → Add New Trigger”.
  2. In the default content field, set the content to be displayed the first time the user visits the page (optional, it can be left blank if you don’t want to show anything).
  3. In the default version content field, paste the following shortcode right below or above the content you have set.
[ifso-add-cookie name='page_visits_count' value='2' time='604800']

The shortcode will add a cookie with the name “page_visits_count” and the value “2”. The cookie will be valid for 604,800 seconds (1 week). You can change these values at your convenience.

  1. In version A, click on “Select a condition” and select “Cookie“.
  2. Set the cookie name to “page_visits_count” and the value to “2”.
  3. In the content field (of version A), set the content to be displayed on the second visit of the user to the page.
  4. Press “Publish” and paste the shortcode generated by If>So on your website.

Creating a sequence of several different content versions (more than 2)

To display a different content version the third time the user visits the page, simply add the “Add a cookie” shortcode to the content of version A. The cookie value, this time, should be 3. When users encounter the shortcode, the value of the cookie in their browser will be replaced with 3.

You can now add another version to your trigger with another cookie condition (cookie name “page_visits_count”; cookie value “3”).



Engagement, User Experience




Cookie, New & Returning Visitors, Trigger Visited

Realated templates and examples