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

Calling a Custom Event Without CSS Selector

Avatar

Avatar
Validate 1
Level 4
LeoS_Taco
Level 4

Likes

63 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile

Avatar
Validate 1
Level 4
LeoS_Taco
Level 4

Likes

63 likes

Total Posts

25 posts

Correct Reply

1 solution
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 25
View profile
LeoS_Taco
Level 4

30-10-2017

Hello,

I'm trying to create an event rule for a page where most events are driven by ReactVR objects, not by DOM API or CSS.

I know that I can create a custom event, and track a click that way. (I found the answer here) But, because there aren't any CSS selector to latch onto, I'd like to know if and how I can get around having to use the CSS selector or if there's a trick for that.

Thanks in advance!

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Contributor
MVP
joshd7227840
MVP

Likes

275 likes

Total Posts

241 posts

Correct Reply

70 solutions
Top badges earned
Contributor
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile

Avatar
Contributor
MVP
joshd7227840
MVP

Likes

275 likes

Total Posts

241 posts

Correct Reply

70 solutions
Top badges earned
Contributor
Give Back 10
Give Back 5
Give Back 3
Give Back
View profile
joshd7227840
MVP

01-11-2017

If you want to use this type of Event Based Rule, you can use body as the CSS selector:

chrome_2017-11-01_19-48-35 - Copy.png

I don't know how ReactVR works so I don't know what you do for creating/dispatching custom events, so here is a pure js example:

var myEvent = new CustomEvent('myEvent', { foo : 'bar' });
document.querySelector('body').dispatchEvent(myEvent);

Alternatively, you may consider creating a Direct Call Rule (DCR) instead.  A DCR takes a single string value as a condition, e.g. "foobar" (no quotes).  Then you simply call it like so:

_satellite.track("foobar");

Answers (2)

Answers (2)

Avatar

Avatar
Seeker
Employee
Viddyw
Employee

Likes

15 likes

Total Posts

29 posts

Correct Reply

9 solutions
Top badges earned
Seeker
Shape 1
Give Back
Ignite 1
Publish 1
View profile

Avatar
Seeker
Employee
Viddyw
Employee

Likes

15 likes

Total Posts

29 posts

Correct Reply

9 solutions
Top badges earned
Seeker
Shape 1
Give Back
Ignite 1
Publish 1
View profile
Viddyw
Employee

20-12-2017

This worked for me within the context of just pure JS on an AEM site. There was an existing function that fired upon the site action I was trying to measure and I just added this event within that JS function. Listening for just the body worked great! One note is that it wasn't working until I checked the "apply event handler directly to element" check box

Avatar

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

337 likes

Total Posts

2,286 posts

Correct Reply

815 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile

Avatar
Validate 1000
Community Manager
jantzen_belliston-Adobe
Community Manager

Likes

337 likes

Total Posts

2,286 posts

Correct Reply

815 solutions
Top badges earned
Validate 1000
Springboard
Validate 500
Validate 250
Validate 100
View profile
jantzen_belliston-Adobe
Community Manager

17-11-2017

Leo Shvedsky

Does the previous reply answer your question? If so, would you mind marking it as the correct answer?

Cheers,
Jantzen