Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

DTM keypress question

Avatar

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
c_a11
Level 1

15-10-2015

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?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
c_a11
Level 1

15-10-2015

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"

Answers (3)

Answers (3)

Avatar

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
c_a11
Level 1

15-10-2015

Nope, it doesn't help. I basically want to use DTM to track if the user presses a particular key. 

Avatar

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 1
c_a11
Level 1

Likes

3 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 3
Boost 1
Affirm 1
View profile
c_a11
Level 1

15-10-2015

I also need the KeyDown instead of KeyPress as keypress doesn't capture all the key presses.

Avatar

Avatar
Give Back 25
Employee
shekhardhiman
Employee

Likes

51 likes

Total Posts

688 posts

Correct Reply

330 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Give Back 25
Employee
shekhardhiman
Employee

Likes

51 likes

Total Posts

688 posts

Correct Reply

330 solutions
Top badges earned
Give Back 25
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
shekhardhiman
Employee

15-10-2015

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!