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

SOLVED

On DOM Load JavaScript and Target

JonMaguire
Level 2
Level 2
We have some auto complete JavaScript that is loaded on DOM ready. It is JS for autocomplete functionality for our forms. This is not being captured by one of our Target activities. Is there a way to make our Target activity aware of this?
1 Accepted Solution
rush_pawan
Correct answer by
Community Advisor
Community Advisor

your problem description is very abstract if you can share more details. 

 

based on below, as target response will be asynchronous either you can use mutation observer (https://www.smashingmagazine.com/2019/04/mutationobserver-api-guide/) to observe the activity injection in DOM and based on that function your js function OR define global javascript variable from js and track it.

View solution in original post

2 Replies
rush_pawan
Correct answer by
Community Advisor
Community Advisor

your problem description is very abstract if you can share more details. 

 

based on below, as target response will be asynchronous either you can use mutation observer (https://www.smashingmagazine.com/2019/04/mutationobserver-api-guide/) to observe the activity injection in DOM and based on that function your js function OR define global javascript variable from js and track it.

View solution in original post

SundeepKatepally
Level 5
Level 5

You can call the dom ready function from target too. In the activity you have an option of adding custom code, there you can add script to invoke dom ready function so that you are reinitializing after target activity