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

Is event.button supported with Mousedown event in Adobe Launch?

Avatar

Avatar
Validate 1
Level 1
andylunsford1
Level 1

Like

1 like

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
andylunsford1
Level 1

Like

1 like

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
andylunsford1
Level 1

04-02-2021

Hello, 

 

I'm trying to implement tracking that identifies right click vs left click on a type of link to answer questions regarding a modal flow.  

 

I need to determine if the user clicked on the link with a right click, left click, or other (middle, back, etc.).  I've been attempting to use event.button to refer to the mouseEvent in the custom code section in the action "Adobe Analytics - Set Variables", but it doesn't appear to be returning any value.

 

Event type that triggers the rule is a  "Mousedown" for the CSS selector "a[target='_generic-interstitial']" configured as shown below:

 

Snag_10c80fbf.png

However, when this rule fires, I notice that the value for event.button appears to be unspecified upon reviewing the beacon set.  Is this supported inside the "Mousedown" event type?


Thanks!

Adobe Analytics Adobe Launch click tracking mousedown UI

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Springboard
MVP
yuhuisg
MVP

Likes

152 likes

Total Posts

481 posts

Correct Reply

90 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Establish
Contributor
View profile

Avatar
Springboard
MVP
yuhuisg
MVP

Likes

152 likes

Total Posts

481 posts

Correct Reply

90 solutions
Top badges earned
Springboard
Bedrock
Validate 1
Establish
Contributor
View profile
yuhuisg
MVP

05-02-2021

The "event" object that Launch's Event Types return are usually a "synthetic" event specific to Launch. They are not the actual browser events.

But these synthetic "event" objects normally have a "nativeEvent" field, which refers to the actual browser event. So you should be able to use "event.nativeEvent.button". (I haven't tried this myself.)

You can also use "console.log(event)" in your Rule's Custom Code action to see what Launch returns as its synthetic event.

Answers (1)

Answers (1)

Avatar

Avatar
Validate 1
Level 1
andylunsford1
Level 1

Like

1 like

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile

Avatar
Validate 1
Level 1
andylunsford1
Level 1

Like

1 like

Total Posts

14 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Boost 1
Applaud 5
View profile
andylunsford1
Level 1

04-02-2021

Answering my own question with a solution I was able to make work for anybody who might have a similar need in the future.  Open to better implementation suggestions!

 

I was able to use the Custom Code event type & utilize jQuery to add the event listener. I imagine it would work with JavaScript as well, but I liked the standardization of event.which to avoid issues with left click & right click being identified differently, especially since we already have jQuery on the site.Snag_112ee687.png

Code below:

$('insert-css-selector-here').mousedown(function(event) {
  if (event.which === 3) {
      trigger();
  }
});