Below is my JavaScript function, it needs to run only once. It means that when the user visits the website for the first time the code must be run. When the page reloads it doesn't need to run. I am running this code in WordPress using a custom HTML plugin.
<script>
introJs().setOptions({
steps: [{
intro: "Welcome to our website!"
}, {
title: 'Introducing New Dark Mode',
element: document.querySelector('.menu-main-container'),
intro: "Now you can browse in dark mode or dark theme!"
}]
}).start();
</script>