// Quiz state
let currentQuestion = 1;
const totalQuestions = 5;
const scores = { ga: 0, pro: 0, whale: 0 };
const answers = {};
// Results data
const results = {
whale: {
icon: '๐ณ',
title: "You're a Whale!",
subtitle: "For the serious networker seeking luxury and exclusive access",
description: `
Based on your responses, the Whale Pass is your perfect match. You're here for:
- Exclusive VIP experiences and backstage access
- High-level networking with C-suites and speakers
- All-inclusive luxury amenities and premium hospitality
- Complete 3-day access including Whale Night
`
},
pro: {
icon: '๐',
title: "You're Pro Material!",
subtitle: "For the engaged professional ready to do business",
description: `
The Pro Pass aligns perfectly with your goals. You'll get:
- Full 3-day access including Pro Day
- Curated networking opportunities and app access
- Dedicated business development spaces
- Included lunches and refreshments
`
},
ga: {
icon: '๐งก',
title: "Welcome to GA!",
subtitle: "For newcomers and enthusiasts exploring Bitcoin",
description: `
The GA Pass is ideal for you. Perfect for:
- Learning Bitcoin fundamentals
- Experiencing the event energy
- Exploring the Expo Hall and main sessions
- Flexible, accessible conference experience
`
}
};
// Initialize
function init() {
updateProgress();
setupEventListeners();
}
// Setup event listeners
function setupEventListeners() {
// Option selection
document.querySelectorAll('.option').forEach(option => {
option.addEventListener('click', function() {
const container = this.closest('.question-container');
// Remove previous selection
container.querySelectorAll('.option').forEach(opt => {
opt.classList.remove('selected');
});
// Select this option
this.classList.add('selected');
// Enable next button
const nextBtn = container.querySelector('.btn-next');
nextBtn.disabled = false;
});
});
// Next buttons
document.querySelectorAll('.btn-next').forEach(btn => {
btn.addEventListener('click', handleNext);
});
// Back buttons
document.querySelectorAll('.btn-back').forEach(btn => {
btn.addEventListener('click', handleBack);
});
}
// Handle next button
function handleNext() {
const container = document.querySelector(`[data-question="${currentQuestion}"]`);
const selected = container.querySelector('.option.selected');
if (!selected) return;
// Save answer
const passType = selected.dataset.pass;
const points = parseInt(selected.dataset.points);
answers[currentQuestion] = { passType, points };
scores[passType] += points;
if (currentQuestion < totalQuestions) {
// Move to next question
container.classList.remove('active');
currentQuestion++;
document.querySelector(`[data-question="${currentQuestion}"]`).classList.add('active');
updateProgress();
} else {
// Show results
showResults();
}
}
// Handle back button
function handleBack() {
if (currentQuestion > 1) {
// Remove previous answer from scores
const prevAnswer = answers[currentQuestion];
if (prevAnswer) {
scores[prevAnswer.passType] -= prevAnswer.points;
delete answers[currentQuestion];
}
// Move to previous question
document.querySelector(`[data-question="${currentQuestion}"]`).classList.remove('active');
currentQuestion--;
const prevContainer = document.querySelector(`[data-question="${currentQuestion}"]`);
prevContainer.classList.add('active');
// Re-select previous answer
const prevAnswerData = answers[currentQuestion];
if (prevAnswerData) {
prevContainer.querySelectorAll('.option').forEach(opt => {
if (opt.dataset.pass === prevAnswerData.passType &&
parseInt(opt.dataset.points) === prevAnswerData.points) {
opt.classList.add('selected');
}
});
}
updateProgress();
}
}
// Update progress bar
function updateProgress() {
const progress = ((currentQuestion - 1) / totalQuestions) * 100;
document.getElementById('progressFill').style.width = progress + '%';
}
// Show results
function showResults() {
// Determine winner
let winner = 'pro'; // default
let maxScore = scores.pro;
if (scores.whale > maxScore) {
winner = 'whale';
maxScore = scores.whale;
} else if (scores.whale === maxScore) {
// Tie between whale and pro -> recommend whale
winner = 'whale';
}
if (scores.ga > maxScore) {
winner = 'ga';
} else if (scores.ga === scores.pro && scores.ga > scores.whale) {
// Tie between ga and pro -> recommend pro
winner = 'pro';
}
// Display results
const result = results[winner];
document.getElementById('resultIcon').textContent = result.icon;
document.getElementById('resultTitle').textContent = result.title;
document.getElementById('resultSubtitle').textContent = result.subtitle;
document.getElementById('resultDescription').innerHTML = result.description;
document.getElementById('passType').textContent = winner.toUpperCase();
// Hide quiz, show results
document.querySelectorAll('.question-container').forEach(q => q.classList.remove('active'));
document.getElementById('resultsContainer').classList.add('active');
document.querySelector('.progress-bar').style.display = 'none';
document.querySelector('.quiz-header').style.display = 'none';
// Submit to HubSpot Forms API
submitToHubSpot(winner);
}
// Submit quiz data to HubSpot Forms API
function submitToHubSpot(passRecommendation) {
const portalId = '242236444';
const formId = '2780cab0-ff4b-4c9c-aeae-3ca90e9c4f8a';
const formData = {
fields: [
{
name: 'b26_recommended_pass',
value: passRecommendation.toUpperCase()
},
{
name: 'b26_promo_code',
value: 'PASSQUIZ'
},
{
name: 'b26_quiz_score_ga',
value: scores.ga.toString()
},
{
name: 'b26_quiz_score_pro',
value: scores.pro.toString()
},
{
name: 'b26_quiz_score_whale',
value: scores.whale.toString()
}
],
context: {
pageUri: window.location.href,
pageName: 'Bitcoin 2026 Pass Quiz'
}
};
fetch(`https://api.hsforms.com/submissions/v3/integration/submit/${portalId}/${formId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => response.json())
.then(data => {
console.log('Quiz results submitted to HubSpot:', data);
})
.catch(error => {
console.error('Error submitting to HubSpot:', error);
});
}
// Start quiz
init();