Experiment based on page content

Issue

Sometimes, we would like to implement an experiment based on the page content, instead of URL or Page Tag conditions.

Solution

For this we will implement a JS Condition to look for the content on the page using JQuery and if found it will bucket the visitor on the experiment if he/she visits any page with such content.

For this solution to work, you will need to create the CSS selector for the element that needs to be present on the page, to enable the experiment.

Here is the code:

(function() {
if(document.readyState === 'complete'){
return(false)}
else if(convert.$('.selector').length == 0) {
convert_recheck_experiment();
}
else return (true);
})()

This code is based in this article. And to learn how to create CSS selectors, you can see the video in this article.

Need assistance? Start a conversation with our Support Team.
CONVERT MORE

Reliably Convert More Site Visitors, Even If Everything Else is Changing in Your Business.

START 15-DAY FREE TRIAL
✓ No Credit Card  ✓ Easy Set-Up  ✓ Access All Features

Comments