Expand my Community achievements bar.

Who Me Too'd this topic


Level 2

Hi there


I was wondering if anyone else has had any issues/success with integrating Target into Salesforce Lightning(SFL)? We are trying to run some experiments/personalisation activities within SFL but are having issues with Target being able to modify elements on the page. Target scripts load successfully, and we have successfully injected some CSS onto pages, and modified styles, however DOM manipulations are something else entirely.


There seems to be a lot of refreshing that happens with SFL and some sort of race condition seems to not allow Target to successfully modify the DOM. We have tried the following:

  • Tried to load a SFL page into Target VEC with no luck (iframe refreshes SFL page constantly, never allowing us to select any elements)
  • Tried targeting a HTML ID tag directly in VEC, but it doesn’t seem to have any effect on the SFL page
  • Tried using triggerView() but I guess because the SPA isn’t loading into VEC, neither is the triggerView() function firing
  • As mentioned used Target to inject CSS onto SFL page – styles were successfully changed
  • Used Target to do a redirect – this also was successful


If anyone has encountered any of this, and found ways around it, I’d love to hear how you managed to get Target running within SFLC



Update - it seems the issue with Target not being able to run in SF is due to the locker service, which prevents DOM manipulation, even a simple queryselector in the browser’s console returns null for an element that obviously exists.


Locker service info: https://developer.salesforce.com/docs/component-library/documentation/en/lwc/security_locker_service


Is there any feasible way around this, that anyone can think of, or has successfully implemented?

Who Me Too'd this topic