All Collections
API
Using Fomo in Single Page Apps (SPA)
Using Fomo in Single Page Apps (SPA)

Implement page rules and trigger notifications that are friendly with React, Angular, Vue, and other frontend frameworks.

Elias avatar
Written by Elias
Updated over a week ago

You might be setting up Fomo on a S.P.A. that does not "technically" change pages as visitors click around your website. if this is the case you will need to tell Fomo that page URL has been changed.

Setup

In your web app source code, add a callback in your router to handle triggering Fomo on whatever pages or conditions you'd like.

Here is an example using a Vue app, which does this on every page change:

router.afterEach((to, from) => {
...
if (fomo) {
fomo.trigger('reload')
}
})

This few lines of code will tell Fomo to show notification again or hide it based on rules specified in the settings tab.
โ€‹
โ€‹

Did this answer your question?