Expand my Community achievements bar.

SOLVED

Survey implementation on certain pages using DTM

Avatar

Level 4

I am using DTM and need to implement a survey that only opens on certain pages. I have no issue implementing the survey in DTM. The issue is, since the Rule Conditions work as "and" statements, the usage of the condition will not work. Is there a way in the custom code to use "or" statements for the pages that I want included in the survey?

Would I use something like the below code to have the survey pop on selected pages? Is there a way to do it in the conditions section in DTM?

if ((_satellite.getVar("DOI") == "10.2307/3659443") || (_satellite.getVar("DOI") == "10.2307/3061167")  || (_satellite.getVar("DOI") == "10.2307/40801588"))

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi Bill,

When you are using custom code in rule conditions for a page load rule, you must use the boolean return true when you want the rule to fire.Hence As per the above requirement Please return true from the code. Also, Please make sure that the "Data Element" - "DOI" is available to be used in Custom conditions.

if ((_satellite.getVar("DOI") == "10.2307/3659443") || (_satellite.getVar("DOI") == "10.2307/3061167")  || (_satellite.getVar("DOI") == "10.2307/40801588")) { return true; } else { return false; }

Thanks & Regards

Parit Mittal

View solution in original post

5 Replies

Avatar

Correct answer by
Level 10

Hi Bill,

When you are using custom code in rule conditions for a page load rule, you must use the boolean return true when you want the rule to fire.Hence As per the above requirement Please return true from the code. Also, Please make sure that the "Data Element" - "DOI" is available to be used in Custom conditions.

if ((_satellite.getVar("DOI") == "10.2307/3659443") || (_satellite.getVar("DOI") == "10.2307/3061167")  || (_satellite.getVar("DOI") == "10.2307/40801588")) { return true; } else { return false; }

Thanks & Regards

Parit Mittal

Avatar

Level 4

Parit,

Thank you for the update.

 

Bill

Avatar

Level 4

Parit,

Here is the code that I have for my survey. Once I added the $.getScript, I was getting errors with the "return true", "else" and "return false". I think this work. I wanted to know if you think I am missing anything.

 

if ((_satellite.getVar("DOI") == "10.2307/3659443") || (_satellite.getVar("DOI") == "10.2307/3061167") || (_satellite.getVar("DOI") == "10.2307/40801588"))
 
$.getScript("//ethn.io/53363.js", function(){
  Ethnio.show()});

 

Thanks,

 

Bill

Avatar

Level 10

Hi , 

Everything looks good and I assume that you are using  "return true " in the javascript file " 53363.js"  you are calling through JQuery get script function because as mentioned earlier When we use custom code in rule conditions for a page load rule, we must use the boolean return true when we want the rule to fire.

Thanks & Regards

Parit Mittal

Avatar

Level 4

Parit,

 

Thank you for the feedback.

 

Bill