"load", "beforeunload" event listeners not working in Salesforce Data Cloud Web SDK

52 views Asked by At

I'm trying to add an event listener inside listeners in PageConfig in Data Cloud Web SDK Sitemap to track the interactions on the website.

listeners - An array of event listeners created using the SalesforceInteractions.listener function. These events listen for customer interactions that trigger events to send through the Web SDK.

So when I add window.addEventListener("beforeunload", (e) => { console.log("Page unload"); }) The code is executed correctly and Page unload is printed in console.

But When I use SalesforceInteractions.listener("beforeunload", (e) => { console.log("Page unload"); }) This peice of Code is not executed and Page Unload is not printed in console.

Is there any way where I can use load or unload event listeners using SalesforceInteractions.listener()? Or am I doing something wrong here?

Thanks in Advance!

0

There are 0 answers