// --- Configuration ---
var popunder_url = "https://www.effectivegatecpm.com/yb183h7p?key=dff893cec8f1150f9cd82352ad6c1336";
// Function to open the popunder
function openPopunder() {
// 1. Open a new window
var newWindow = window.open(popunder_url, '_blank', 'width=800,height=600,resizable=yes');
// Check if the window was successfully opened (not blocked)
if (newWindow) {
// 2. The core "pop-under" action:
// Shift focus back to the current window, pushing the new one to the back.
newWindow.blur();
window.focus();
}
}
// --- Trigger the Pop-under on the FIRST click anywhere on the page ---
document.addEventListener('click', function(event) {
// This is a simple implementation. More advanced ones use cookies/localStorage
// to only fire once per session.
// Use a simple flag to ensure it only fires on the first interaction
if (typeof popunder_fired === 'undefined') {
openPopunder();
popunder_fired = true; // Set the flag to prevent re-firing
}
}, { once: true }); // The {once: true} option ensures the listener is removed after the first click
var popunder_url = "https://www.effectivegatecpm.com/yb183h7p?key=dff893cec8f1150f9cd82352ad6c1336";
// Function to open the standard pop-up
function openPopUp() {
// 1. Open a new window (which will naturally open on top)
var newWindow = window.open(popunder_url, '_blank', 'width=800,height=600,resizable=yes');
// **POP-UP LOGIC:**
// To make it a pop-up, we intentionally OMIT the lines that shift focus back
// (newWindow.blur() and window.focus()).
// The new window (newWindow) will automatically receive focus and stay on top.
}
// --- Trigger the Pop-up on the FIRST click anywhere on the page ---
document.addEventListener('click', function(event) {
// Use the flag (and the {once: true} option) to ensure it only fires once
if (typeof popup_fired === 'undefined') {
openPopUp();
popup_fired = true; // Set the flag to prevent re-firing
}
}, { once: true }); // The {once: true} option ensures the listener is removed after the first click