Streaming live at 10am (PST)

Cookie script for pop up modal

Hi there :slight_smile:

Is there someone here who can help with a script that let me give a user a pop-up the 5th time they visit the website? So the first 4 time they don’t see it, the 5th they see it. If they close it they won’t see it again.

I have this script that works great for first time visitors. Maybe it can be modified?

<!-- Cookie Script START -->
<script src="https://cdn.jsdelivr.net/npm/js-cookie@2/src/js.cookie.min.js"></script>

<script>
var cookieName = 'modalClosed';
if(typeof Cookies.get(cookieName) !== 'undefined') {
$('.modal-wrapper').remove();
}
$('.modal-close-button, .modal-success-close-btn').on('click', function(){
Cookies.set(cookieName, 'ok', { expires: 365 });
})
</script>
<!-- Cookie Script END -->

Appreciate all help I can get <3

Ruben