Expand my Community achievements bar.

WebSDK Update Variables - scope of 'this'

Avatar

Level 2

Hi there,

 

We're working through a WebSDK migration at the moment and I have a question about 'this' scope in Update Variables

 

In old AA:

If I have a rule that fires on clicking something, in AA Update Variables Custom Code the 'this' object references the clicked HTML element.

 

In WebSDK:

Same rule, WebSDK Update Variables Custom Code, the 'this' now is the entire window object.

 

Does anyone have a way to get the clicked HTML element that fired the rule?

 

Side question is there any documentation around which javascript objects/function/etc the Web SDK Ext has access to?

 

Thanks!

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

3 Replies

Avatar

Level 2

Update:

After some research, we can access the clicked element with the 'event' object. For reference the 'event' object is part of the Core Extension and is populated in every rule.

 

a console.log(event) outputs something like the below screenshot

 

PaulBr15_0-1726449910269.png

 

Avatar

Administrator

@PaulBr15 Did you find the suggestion helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni