Integrate with Single Page App

Single-page Applications (SPAs) only trigger a full page load when they are first loaded. Otherwise, navigating across pages in your app doesn't trigger a page load. Userback code needs to be notified when a page url changes in your app so that the correct content will show to the end-users.

Here is how you do it:

The code will need to be added to any page that is considered a new page in your application's routing code.

Userback.refresh();

Manual state changes should be compatible with any front-end JavaScript library. Here is an example of the code in Next.js (React).

const router = useRouter();

useEffect(() => {
    Userback.refresh();
}, [router.asPath]);

When Userback.refresh() is called, it will check all the targeting conditions again and show or hide the correct feedback widget or survey.