Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards

How to control the lighbox(pop-up) should show once in a session?

Avatar

Level 1

I want to show 2 different offers(experiences) to 2 different audiences.  I have created the activity as Experience Targeting. My website is a SPA, but I have used different pages(the URL is not refresh when I move to next page). 

 

The lightbox open when the user go to the PDP pages. The pop-up open again and again in single session. 

Example: product1, product2, product3,.... User come to product1 page the popup showing but the user close the popup again go to product3 the popup showing again. 

 

But I want to control this, Once the user close the popup, it should not open in the same session. How can we achieve this?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Level 3

Hi @jayasekar ,
You can handle this by setting a flag once the popup is closed and then checking that flag before showing it again. For example, use a sessionStorage variable (or a cookie) when the user closes the popup:

// When popup is closed
sessionStorage.setItem("popupClosed", "true");

// Before showing popup
if (!sessionStorage.getItem("popupClosed")) {
// show popup
}

OR
you can Create a profile script like popupClosed = true when user closes.Use an audience condition in your activity to only show the popup if popupClosed != true.

the first option with sessionStorage is usually enough — it ensures the popup won’t reappear again in the same session even if the user navigates to multiple product detail pages.

 

Avatar

Community Advisor

@jayasekar : Do you think using sessionStorage for storing the flag if pop-up is already shown can work for you? You can store this value on rendering of pop-up or click of close/accept/ok button on pop-up. Before rendering this pop-up, you can check if this flag/value is present in sessionStorage.

Since sessionStorage keeps values until you close your browser, it should not show it until you are in current session.

I don't understand your complete use-case but please see if this could work for you.

 

thanks.