Survey implementation on certain pages using DTM | Community
Skip to main content
Level 3
April 1, 2016
Solved

Survey implementation on certain pages using DTM

  • April 1, 2016
  • 5 replies
  • 2041 views

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"))

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by ParitMittal

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

5 replies

ParitMittal
ParitMittalAccepted solution
Level 10
April 4, 2016

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

Bsmith320Author
Level 3
April 5, 2016

Parit,

Thank you for the update.

 

Bill

Bsmith320Author
Level 3
April 20, 2016

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

ParitMittal
Level 10
April 22, 2016

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

Bsmith320Author
Level 3
April 22, 2016

Parit,

 

Thank you for the feedback.

 

Bill