> ## Documentation Index
> Fetch the complete documentation index at: https://docs.notifly.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Show a web popup

> Create a web popup template, choose who sees it and when, and test it in your browser.

## Overview

Install the [Notifly JavaScript SDK](https://docs.notifly.tech/en/developer-guide/javascript-sdk.md) on your site.

## 1. Build a popup template

Web and in-app popups use templates. To create a web popup template, open **Message Templates > Web Popup Templates** in the [Notifly console](https://console.notifly.tech/en/auth/login).

## 2. Set the audience

Set up a user group to choose who sees the popup. See [Set up a user group](https://docs.notifly.tech/en/user-guide/campaigns/campaign-segments/segment.md#1-user-group-settings).

## 3. Set when to show the popup

For a web popup campaign, choose **Event-Based Send** and select the event that should display the popup.

### Example 1. Show a popup when an `add_to_cart` event occurs

To display the popup immediately after `add_to_cart`, select `add_to_cart` as the event and use the timing shown below.

![Popup timing settings for an add-to-cart event](https://mintcdn.com/notifly/BljWoGqDT6exoK9p/images/i18n/en/web-message/basic.png?fit=max\&auto=format\&n=BljWoGqDT6exoK9p\&q=85\&s=b3f953c319dd22bdc037a6f054a774c3)

### Example 2. Show a popup five seconds after a `ticket_purchase` event

Set `ticket_purchase` as the event and set a five-second delay.

![Popup timing settings with a five-second delay](https://mintcdn.com/notifly/BljWoGqDT6exoK9p/images/i18n/en/web-message/delay.png?fit=max\&auto=format\&n=BljWoGqDT6exoK9p\&q=85\&s=4e4a133437c837f81461e1dee175ea71)

### Example 3. Show a popup five seconds after a `pageview` event when `path` equals `/product`

Set `pageview` as the event and set a five-second delay. Add a condition so the popup appears only when `path` is `/product`.

![Popup timing settings with a five-second delay and path set to /product](https://mintcdn.com/notifly/BljWoGqDT6exoK9p/images/i18n/en/web-message/conditional.png?fit=max\&auto=format\&n=BljWoGqDT6exoK9p\&q=85\&s=060d3e5da824255d7a4e81dada0b827d)

## 4. Select a template and create the campaign

1. In **Message and Action**, click **Select Template**. Choose the web popup template you saved, then click **Select**.
2. Click **Final Confirmation** and review the campaign settings. Then click **Create Campaign**.

## 5. Reload a popup campaign for testing

The SDK loads web popup campaigns when it initializes. To avoid extra network requests, it attempts to initialize only once per session. A session lasts 30 minutes by default.

If you create a campaign during an active session, reinitialize the SDK before testing in the same browser.

### 1. Use Incognito mode

Close the browser window completely and reopen it in Incognito mode. The SDK initializes again and loads the campaign.

### 2. Change the user ID with `setUserId`

Call `setUserId` with a different user ID to reinitialize the SDK.

### 3. Delete the session record from IndexedDB

> [!WARNING]
>
> Delete only `__notiflyLastSessionTime`. Deleting other data can prevent the Notifly SDK from working correctly.

* Open the **Application** tab in browser developer tools.
* In the sidebar, open **Storage > IndexedDB > notifly > notiflyconfig**.
* Select `__notiflyLastSessionTime`, then click the delete button in the upper right to remove that row.
* Reload the page to reinitialize the SDK and load the campaign.

![IndexedDB record to delete before reinitializing the SDK](https://mintcdn.com/notifly/BljWoGqDT6exoK9p/images/i18n/en/web-message/force-init.png?fit=max\&auto=format\&n=BljWoGqDT6exoK9p\&q=85\&s=56ecabb4c0175e3af4c51d017223ee84)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.