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

Find the DOM element that triggered a rule within a custom script data element

thomas_amsler
Level 9
Level 9

I want to have as little custom code in the analytics rules as possible. If I need custom code I create data elements for it and use them with the %% annotations in the analytics part (e.g. eVar5=%CS-myDataElem%). Now I am struggling to get to the event that triggered a rule where I want to use this custom script data element.

In my specific case I have some custom logic vor video playback and I want to extract the currentTime from the video object. I've seen with a JS debugger, that the video tag that triggered my "% complete" rule can be found in "this" of my custom script:

this.customJS.caller.caller.caller.arguments[1]

So I was wondering is there a helper method in _satellite or some other global object where I can get the DOM element that triggered this rule?

Or do I really have to use custom code in the rule itself? I have multiple rules which need the same code snippets so I need to duplicate some code.

0 Replies