Why do my conditions show a false-value in my console?

In this article, we explained how you could check the deployment conditions on your website. We also explained how you can debug your script if your survey did not show as you had expected. In the following article, we will elaborate more on the deployment conditions and the reasons why these conditions can show a false-value in your console.

 

Step 1

Go to ‘Data collection’ > ‘Deployments’. Click on the pencil button of the deployment you want to edit. Drag the form you want to use to the centre and go to ‘Targeting’.

 

Step 2

Open the developer tools on your website, by clicking on the icon with three dots, in the top right corner, then, ‘More tools’ > ‘Developer tools’.

 

Step 3

Go to the console tab, and type the following in the command line: document.cookie='LOG=true'. Refresh your page. You will see a page with ‘P>’ on each line.

 

Step 4

If you have all toggles switched off in your deployment, except for ‘Append div to body of the page if not found’, you should only see ‘true’-values in the console of the development tools. You should also see ‘triggered!’ on the last line of your console. Remember, if you have recently made changes to your form, your previous version is still saved in your cache and cookies. See this article for more information.

If you want to switch on one of the toggles in the deployment, your console could show a false-value for that condition.

 

Example 1

Say, you only want to show your form to 10% of your users. Switch on the toggle ‘Show only to a percentage of users’, and enter the value 10 as your percentage. Save the deployment by clicking on the green save button in the top right corner. Now, go back to the developer tools on your website. Since you have changed the deployment, you first need to delete your cookies. See this article on how to do this.

 

Once your cookies are deleted, go back to the ‘Console’ tab, and click on refresh. You will see a line with ‘passive condition set’ and a random number. If this random number is smaller than your percentage, it will return the value true. If this random number is larger than your percentage, it will return the value false. You will only see this line the first time you refresh the page. In this case, 79.5 is the random number, which is larger than 10, so it will return a false value. If all is done well, and you got a false-value, you should not see ‘triggered!’ on the last line anymore, instead, you should see ‘not all OK…’ on the second to last line.

 

Testing and triggering surveys with a low ‘Show only to a percentage of users’ rate can be time-consuming. To manually trigger the survey you can edit the cookie values of the following cookies:

 

Pastease.[trigger_type].activated.XXX

Pastease.[trigger_type].chance.XXX

 

You can set the value of Pastease.[trigger_type].chance.XXXXX to “chance01.0” (or anything below the value used at ‘Show only to a percentage of users’). This is done by double-clicking on this cookie, in the Application tab. In our example, the random number was 79.5, which gave us a false-value. If you change this number to 1.0 we will get a true-value, since 1.0 is smaller than our percentage, 10. You can delete Pastease.[trigger_type].activated.XXX. 


If you now reload the page, this rule should be evaluated as true.

 

Example 2

It is also possible to add a condition based on a URL. In your deployment, switch on the toggle for ‘Show based on URL conditions’. Add two URLs by clicking on ‘(+) AND’: 

Both of these URLs should be correct according to our condition. This, however, is not possible. In your console tab, you will see a false-value for location:

 

In order to use these two URLs, you will need to use the ‘(+) OR’ button, instead of  ‘(+) AND’: 

You should now see a true-value, if you are indeed on one of the specified URLs, for location in your console:

 

Example 3

Let’s say you only want to show your form on a specific date. Turn this toggle on, and set your condition. In this example, we will use: 

If you go back to your console, you will see a false-value for ‘Date’, if your condition is false, and a true-value if it is indeed before 14/08/2020. In this case, our condition is false:


You can also set several conditions to your deployment.