Can I do the same with a page and a box?

Hi!
I’m trying to do a page and a box that only shows to “first-time” visitors of my site. I’ve seen people doing this with lightboxes (with the code showed below), but I don’t know how to do it on other elements.

import {session} from 'wix-storage';
import wixWindow from 'wix-window';

$w.onReady(function () {
 if(!session.getItem("firstTimePopupShown")) {
    wixWindow.openLightbox("Bienvenido");
    session.setItem("firstTimePopupShown", "yes");
  }
} );

Thanks in advance.

Yes. You can.
But first, for showing 1 time only, you need to use local not session, and to do something like:

import { local } from 'wix-storage';
$w.onReady(function () {
 if(typeof local.getItem("firstTimeBoxShown") !== "string") {
    $w("#box1").expand();
    local.setItem("firstTimeBoxShown", "yes");
} else {
    $w("#box1").collapse();
  }
} );