Hi people, new to DTM.
I am trying to setup a keypress condition which only fires if keyCode is X. How do I setup the rule properly for the keyCode check?
Solved! Go to Solution.
Alright, I managed to "hack" it up so it works.
Summary of issues:
1) Expose KeyDown as rule condition
2) In the script, when defining the condition function, DTM should pass the same variable that is passed through to the ruleMatch function.
ie.
var h = b.find(o, function(e) {
try {
return !e.call(i, n, u)...
e is the condition function which is called with 3 variables. But on init, the condition is only declared as a simple function()
conditions: [function() {
It should take in 3 variables too so that custom rule condition can make use of the 3 variables for customized tracking.
The below is what I used in the pageload rule to run a custom "hack" for my rule. My event rule is I want to track left arrow key press when a pop up is in the dom (media gallery scenario)
_satellite.registerEvents($("body")[0], ["keydown"])
_satellite.rules[0].conditions[0] = function(i, n, u){console.log(i); return $("popup").length>0&&37===i.keyCode;};
_satellite.rules[0].event = "keydown"
Hi There,
Thanks for reaching out to Adobe Community.
Please see if the below article helps:
http://microsite.omniture.com/t2/help/en_US/dtm/t_rules_event_conditions.html
Thanks!
Views
Replies
Total Likes
Nope, it doesn't help. I basically want to use DTM to track if the user presses a particular key.
I also need the KeyDown instead of KeyPress as keypress doesn't capture all the key presses.
Views
Replies
Total Likes
Alright, I managed to "hack" it up so it works.
Summary of issues:
1) Expose KeyDown as rule condition
2) In the script, when defining the condition function, DTM should pass the same variable that is passed through to the ruleMatch function.
ie.
var h = b.find(o, function(e) {
try {
return !e.call(i, n, u)...
e is the condition function which is called with 3 variables. But on init, the condition is only declared as a simple function()
conditions: [function() {
It should take in 3 variables too so that custom rule condition can make use of the 3 variables for customized tracking.
The below is what I used in the pageload rule to run a custom "hack" for my rule. My event rule is I want to track left arrow key press when a pop up is in the dom (media gallery scenario)
_satellite.registerEvents($("body")[0], ["keydown"])
_satellite.rules[0].conditions[0] = function(i, n, u){console.log(i); return $("popup").length>0&&37===i.keyCode;};
_satellite.rules[0].event = "keydown"
Views
Likes
Replies
Views
Likes
Replies