
Concerts
super-embed:
<body>
<html>
<div id="newsletter-popup" class="popup-overlay">
<div class="popup-content">
<span class="close-btn" onclick="closePopup()">×</span>
<!-- Newsletter Form -->
<div id="form-section">
<h2>Subscribe to Our Newsletter</h2>
<p>Get updates delivered straight to your inbox!</p>
<form id="newsletter-form">
<!-- Name Field -->
<input id="newsletter-name" type="text" name="name" placeholder=" Name" required>
<!-- Email Field -->
<input id="newsletter-email" type="email" name="email" placeholder="Email" required>
<button type="submit">Subscribe</button>
</form>
</div>
<!-- Confirmation Message -->
<div id="confirmation-section" style="display: none;">
<h2>Thank You!</h2>
<p>A confirmation email has been sent.</p>
</div>
</div>
</div>
<script>
// IMPORTANT - Initially hide the popup
document.getElementById("newsletter-popup").style.display = "none";
// Function to check if we should show the popup
function shouldShowPopup() {
// Check if user has already subscribed or dismissed
return !localStorage.getItem('newsletterSubscribed') &&
!localStorage.getItem('newsletterDismissed');
}
// Function to open popup
function openPopup() {
// Only show if we should
if (shouldShowPopup()) {
document.getElementById("newsletter-popup").style.display = "flex";
}
}
// Function to close popup
function closePopup() {
document.getElementById("newsletter-popup").style.display = "none";
// Remember that user dismissed the popup
localStorage.setItem('newsletterDismissed', 'true');
}
// Get the form element
const form = document.getElementById('newsletter-form');
// Add event listener for form submission
form.addEventListener('submit', function(event) {
event.preventDefault(); // Prevent the default form submission
// Get the name and email values
let name = document.getElementById("newsletter-name").value;
let email = document.getElementById("newsletter-email").value;
// Hide form and show confirmation message
document.getElementById("form-section").style.display = "none";
document.getElementById("confirmation-section").style.display = "block";
// Remember that user subscribed
localStorage.setItem('newsletterSubscribed', 'true');
// Send data to webhook
sendToWebhook(name, email);
});
// Function to send data to webhook
function sendToWebhook(name, email) {
let webhookURL = "<https://hook.eu2.make.com/2e4nbm4w4sik8s1qoayxxz2qpiv9na3u>";
let data = { name: name, email: email };
fetch(webhookURL, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then(response => {
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
console.log("Webhook triggered successfully");
})
.catch(error => {
console.error("Webhook error:", error);
});
}
// Wait 5 seconds before showing the popup
window.addEventListener('DOMContentLoaded', function() {
console.log("Page loaded, scheduling popup in 5 seconds");
setTimeout(function() {
console.log("5 seconds passed, attempting to show popup");
openPopup();
}, 5000);
});
</script>
</body>
</html>