WebSDK Update Variables - scope of 'this' | Community
Skip to main content
New Participant
September 11, 2024
Question

WebSDK Update Variables - scope of 'this'

  • September 11, 2024
  • 3 replies
  • 883 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

kautuk_sahni
Employee
October 18, 2024

@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
RiteshY18
New Participant
September 17, 2024
PaulBr15Author
New Participant
September 16, 2024

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