Built With Science – Jeremy Ethier
'.v{box-sizing:border-box;display:flex;align-items:center;justify-content:center;min-height:56px;padding:0 40px;background:#0b6dff;border-bottom:1px solid #0957cc;}',
'a:hover .v{background:#0a62e6;}',
'.row{display:flex;align-items:center;justify-content:center;gap:48px;}',
'.label{font-family:Lato,sans-serif;font-weight:700;font-size:12px;line-height:1.2;letter-spacing:.2em;text-transform:uppercase;white-space:nowrap;}',
'.div{width:1px;height:22px;background:#6fa8ff;flex-shrink:0;}',
'.head{font-family:Oswald,sans-serif;font-weight:500;font-size:21px;line-height:1;letter-spacing:.01em;text-transform:uppercase;white-space:nowrap;}',
'.timer{display:flex;align-items:center;gap:16px;}',
'.ends{font-size:11px;letter-spacing:.18em;}',
'.tiles{display:flex;gap:6px;}',
'.tile{box-sizing:border-box;display:inline-flex;align-items:baseline;justify-content:center;width:36px;height:28px;padding-top:4px;border-radius:5px;background:#0850bd;border:1px solid #0745a3;}',
'.dg{font-family:Oswald,sans-serif;font-weight:500;font-size:15px;line-height:1.2;font-variant-numeric:tabular-nums;}',
'.un{font-family:Lato,sans-serif;font-weight:700;font-size:11px;line-height:1;margin-left:1px;}',
'.today{display:none;width:auto;padding:4px 10px 0;}',
'@media (min-width:700px) and (max-width:1023px){.sale,.div.first{display:none;}}',
'@media (max-width:699px){.v{min-height:0;padding:11px 16px;}.row{flex-direction:column;gap:6px;}.div{display:none;}',
'.label{font-size:10px;letter-spacing:.16em;}.head{font-size:18px;}.timer{gap:10px;}.ends{font-size:10px;letter-spacing:.16em;}',
'.tiles{gap:4px;}.tile{width:32px;height:22px;padding-top:2px;}.dg{font-size:13px;}.un{font-size:10px;}.today{width:auto;padding:2px 8px 0;}}',
// control: today's quiz pricing banner (gift icon, gradient, timer pill).
// Oswald 600 where the quiz uses 700: the site's Oswald 700 face never loads.
'.c{box-sizing:border-box;display:flex;align-items:center;padding:12px 16px;background:linear-gradient(275.4deg,#074199 45.31%,#0B6DFF 59.75%);border-bottom:4px solid #0558D4;box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);}',
'.cin{display:flex;align-items:center;width:100%;}',
'.ctext{margin-left:10px;font-family:Oswald,sans-serif;color:#fff;}',
'.l1{font-weight:600;font-size:10px;line-height:14px;letter-spacing:.4px;}',
'.l2{font-weight:500;font-size:12px;line-height:14px;}',
'.l3{display:none;font-weight:500;font-size:20px;line-height:24px;}',
'.cends{display:none;font-family:Oswald,sans-serif;font-weight:500;font-size:20px;line-height:24px;margin-left:auto;margin-right:12px;}',
'.pill{box-sizing:border-box;display:flex;align-items:center;gap:8px;margin-left:auto;flex-shrink:0;padding:6px 10px;background:rgba(255,255,255,.1);border:2px solid rgba(255,255,255,.5);border-radius:1000px;font-family:Oswald,sans-serif;font-weight:600;}',
'.pill svg{display:none;width:24px;height:24px;}',
'.cells{display:flex;align-items:flex-start;line-height:12px;}',
'.cell{display:flex;flex-direction:column;margin:0 3px;}',
'.cd{font-size:18px;font-variant-numeric:tabular-nums;}',
'.cu{font-size:10px;margin-top:2px;text-align:center;}',
'.cended{display:none;font-size:18px;line-height:24px;text-transform:uppercase;white-space:nowrap;}',
'@media (min-width:769px){.pill{padding:3px 16px;}.pill svg{display:block;}.cd{font-size:20px;}.cells{line-height:21px;}.cu{margin-top:-4px;}.cended{font-size:20px;line-height:30px;}}',
'@media (min-width:900px){.c{padding:10px 32px 8px 16px;}.cin{max-width:1050px;margin:0 auto;}.l1,.l2{display:none;}.l3{display:block;}.cends{display:flex;}.pill{margin-left:0;}}'
].join('');
var GIFT = '
';
var CLOCK = '
';
function pad(n) { return (n < 10 ? '0' : '') + n; }
function parts(ms) {
var t = Math.max(0, Math.floor(ms / 1000));
return [Math.floor(t / 86400), Math.floor((t % 86400) / 3600), Math.floor((t % 3600) / 60), t % 60];
}
function render(arm, endsAt) {
var host = document.createElement('div');
host.id = 'bws-web48-banner';
host.setAttribute('data-arm', arm);
var root = host.attachShadow ? host.attachShadow({ mode: 'open' }) : host;
var counting = function () { return endsAt !== null && Date.now() < endsAt; };
var html;
if (arm === 'variation') {
html = '
' +
'EXCLUSIVE FALL SALE' +
'GET 20% OFF + 14 DAYS FREE' +
'ENDS IN' +
'' + ['d', 'h', 'm', 's'].map(function (u) {
return '00' + u + '';
}).join('') + 'TODAY
';
} else {
html = '
' + GIFT +
'
EXCLUSIVE FALL SALE
Get 20% Off + 14 Days Free
' +
'
EXCLUSIVE FALL SALE: Get 20% Off + 14 Days Free
' +
'
Ends in:
' + CLOCK + '' +
['days', 'hrs', 'min', 'sec'].map(function (u, i) {
return (i ? ':' : '') + '00' + u + '';
}).join('') + 'Ends today
';
}
root.innerHTML = '' + html;
var digits = root.querySelectorAll(arm === 'variation' ? '.dg' : '.cd');
var timer = root.querySelector('[role="timer"]');
function show(sel, value) {
var els = root.querySelectorAll(sel);
for (var i = 0; i < els.length; i++) els[i].style.display = value;
}
function tick() {
if (endsAt === null) {
// No end date: copy only.
show(arm === 'variation' ? '.timer, .tdiv' : '.cends, .pill', 'none');
return false;
}
if (!counting()) {
// Past the end date: "ENDS [TODAY]" / "Ends today" where the countdown was.
if (arm === 'variation') {
root.querySelector('.ends').textContent = 'ENDS';
show('.tiles', 'none');
show('.today', 'inline-flex');
} else {
show('.cends, .cells', 'none');
show('.cended', 'block');
root.querySelector('.pill').style.marginLeft = 'auto';
}
timer.removeAttribute('aria-label');
return false;
}
var p = parts(endsAt - Date.now());
for (var j = 0; j < 4; j++) digits[j].textContent = pad(p[j]);
timer.setAttribute('aria-label', 'Offer ends in ' + p[0] + ' days, ' + p[1] + ' hours, ' + p[2] + ' minutes');
return true;
}
if (tick()) {
var id = setInterval(function () { if (!tick()) clearInterval(id); }, 250);
}
document.body.insertBefore(host, document.body.firstChild);
}
function start() {
loadStatsig(function () {
var client = new window.Statsig.StatsigClient(CLIENT_KEY, { customIDs: { stableID: stableID } }, { environment: { tier: 'production' } });
client.initializeAsync().then(function () {
var arm = forced || client.getExperiment(EXPERIMENT).get('arm', null);
if (arm !== 'control' && arm !== 'variation') return;
var endsAt = Date.parse(client.getDynamicConfig(CONFIG).get('ends_at', ''));
render(arm, isNaN(endsAt) ? null : endsAt);
trackExposure(arm);
}).catch(function () { /* no banner */ });
});
}
if (document.body) start();
else document.addEventListener('DOMContentLoaded', start);
})();
}
function trackExposure(arm) {
if (getCookie('bws_web48_exposed')) return;
setCookie('bws_web48_exposed', arm, 90);
var props = { experimentName: EXPERIMENT, variantName: arm };
// The site loads Amplitude asynchronously: retry for up to 10 s.
var tries = 0;
(function send() {
if (window.amplitude && typeof window.amplitude.track === 'function') {
try { window.amplitude.track('ExperimentStarted', props); } catch (e) { /* ignore */ }
return;
}
if (++tries < 40) setTimeout(send, 250);
})();
}
var CSS = [
':host{all:initial;display:block;position:relative;z-index:100000;}',
'a{display:block;text-decoration:none;color:#fff;cursor:pointer;}',
'.v{box-sizing:border-box;display:flex;align-items:center;justify-content:center;min-height:56px;padding:0 40px;background:#0b6dff;border-bottom:1px solid #0957cc;}',
'a:hover .v{background:#0a62e6;}',
'.row{display:flex;align-items:center;justify-content:center;gap:48px;}',
'.label{font-family:Lato,sans-serif;font-weight:700;font-size:12px;line-height:1.2;letter-spacing:.2em;text-transform:uppercase;white-space:nowrap;}',
'.div{width:1px;height:22px;background:#6fa8ff;flex-shrink:0;}',
'.head{font-family:Oswald,sans-serif;font-weight:500;font-size:21px;line-height:1;letter-spacing:.01em;text-transform:uppercase;white-space:nowrap;}',
'.timer{display:flex;align-items:center;gap:16px;}',
'.ends{font-size:11px;letter-spacing:.18em;}',
'.tiles{display:flex;gap:6px;}',
'.tile{box-sizing:border-box;display:inline-flex;align-items:baseline;justify-content:center;width:36px;height:28px;padding-top:4px;border-radius:5px;background:#0850bd;border:1px solid #0745a3;}',
'.dg{font-family:Oswald,sans-serif;font-weight:500;font-size:15px;line-height:1.2;font-variant-numeric:tabular-nums;}',
'.un{font-family:Lato,sans-serif;font-weight:700;font-size:11px;line-height:1;margin-left:1px;}',
'.today{display:none;width:auto;padding:4px 10px 0;}',
'@media (min-width:700px) and (max-width:1023px){.sale,.div.first{display:none;}}',
'@media (max-width:699px){.v{min-height:0;padding:11px 16px;}.row{flex-direction:column;gap:6px;}.div{display:none;}',
'.label{font-size:10px;letter-spacing:.16em;}.head{font-size:18px;}.timer{gap:10px;}.ends{font-size:10px;letter-spacing:.16em;}',
'.tiles{gap:4px;}.tile{width:32px;height:22px;padding-top:2px;}.dg{font-size:13px;}.un{font-size:10px;}.today{width:auto;padding:2px 8px 0;}}',
// control: today's quiz pricing banner (gift icon, gradient, timer pill).
// Oswald 600 where the quiz uses 700: the site's Oswald 700 face never loads.
'.c{box-sizing:border-box;display:flex;align-items:center;padding:12px 16px;background:linear-gradient(275.4deg,#074199 45.31%,#0B6DFF 59.75%);border-bottom:4px solid #0558D4;box-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);}',
'.cin{display:flex;align-items:center;width:100%;}',
'.ctext{margin-left:10px;font-family:Oswald,sans-serif;color:#fff;}',
'.l1{font-weight:600;font-size:10px;line-height:14px;letter-spacing:.4px;}',
'.l2{font-weight:500;font-size:12px;line-height:14px;}',
'.l3{display:none;font-weight:500;font-size:20px;line-height:24px;}',
'.cends{display:none;font-family:Oswald,sans-serif;font-weight:500;font-size:20px;line-height:24px;margin-left:auto;margin-right:12px;}',
'.pill{box-sizing:border-box;display:flex;align-items:center;gap:8px;margin-left:auto;flex-shrink:0;padding:6px 10px;background:rgba(255,255,255,.1);border:2px solid rgba(255,255,255,.5);border-radius:1000px;font-family:Oswald,sans-serif;font-weight:600;}',
'.pill svg{display:none;width:24px;height:24px;}',
'.cells{display:flex;align-items:flex-start;line-height:12px;}',
'.cell{display:flex;flex-direction:column;margin:0 3px;}',
'.cd{font-size:18px;font-variant-numeric:tabular-nums;}',
'.cu{font-size:10px;margin-top:2px;text-align:center;}',
'.cended{display:none;font-size:18px;line-height:24px;text-transform:uppercase;white-space:nowrap;}',
'@media (min-width:769px){.pill{padding:3px 16px;}.pill svg{display:block;}.cd{font-size:20px;}.cells{line-height:21px;}.cu{margin-top:-4px;}.cended{font-size:20px;line-height:30px;}}',
'@media (min-width:900px){.c{padding:10px 32px 8px 16px;}.cin{max-width:1050px;margin:0 auto;}.l1,.l2{display:none;}.l3{display:block;}.cends{display:flex;}.pill{margin-left:0;}}'
].join('');
var GIFT = '
';
var CLOCK = '
';
function pad(n) { return (n < 10 ? '0' : '') + n; }
function parts(ms) {
var t = Math.max(0, Math.floor(ms / 1000));
return [Math.floor(t / 86400), Math.floor((t % 86400) / 3600), Math.floor((t % 3600) / 60), t % 60];
}
function render(arm, endsAt) {
var host = document.createElement('div');
host.id = 'bws-web48-banner';
host.setAttribute('data-arm', arm);
var root = host.attachShadow ? host.attachShadow({ mode: 'open' }) : host;
var counting = function () { return endsAt !== null && Date.now() < endsAt; };
var html;
if (arm === 'variation') {
html = '
' +
'EXCLUSIVE FALL SALE' +
'GET 20% OFF + 14 DAYS FREE' +
'ENDS IN' +
'' + ['d', 'h', 'm', 's'].map(function (u) {
return '00' + u + '';
}).join('') + 'TODAY
';
} else {
html = '
' + GIFT +
'
EXCLUSIVE FALL SALE
20% Off + 14 Days Free
' +
'
EXCLUSIVE FALL SALE: 20% Off + 14 Days Free
' +
'
Ends in:
' + CLOCK + '' +
['days', 'hrs', 'min', 'sec'].map(function (u, i) {
return (i ? ':' : '') + '00' + u + '';
}).join('') + 'Ends today
';
}
root.innerHTML = '' + html;
var digits = root.querySelectorAll(arm === 'variation' ? '.dg' : '.cd');
var timer = root.querySelector('[role="timer"]');
function show(sel, value) {
var els = root.querySelectorAll(sel);
for (var i = 0; i < els.length; i++) els[i].style.display = value;
}
function tick() {
if (endsAt === null) {
// No end date: copy only.
show(arm === 'variation' ? '.timer, .tdiv' : '.cends, .pill', 'none');
return false;
}
if (!counting()) {
// Past the end date: "ENDS [TODAY]" / "Ends today" where the countdown was.
if (arm === 'variation') {
root.querySelector('.ends').textContent = 'ENDS';
show('.tiles', 'none');
show('.today', 'inline-flex');
} else {
show('.cends, .cells', 'none');
show('.cended', 'block');
root.querySelector('.pill').style.marginLeft = 'auto';
}
timer.removeAttribute('aria-label');
return false;
}
var p = parts(endsAt - Date.now());
for (var j = 0; j < 4; j++) digits[j].textContent = pad(p[j]);
timer.setAttribute('aria-label', 'Offer ends in ' + p[0] + ' days, ' + p[1] + ' hours, ' + p[2] + ' minutes');
return true;
}
if (tick()) {
var id = setInterval(function () { if (!tick()) clearInterval(id); }, 250);
}
document.body.insertBefore(host, document.body.firstChild);
}
function start() {
loadStatsig(function () {
var client = new window.Statsig.StatsigClient(CLIENT_KEY, { customIDs: { stableID: stableID } }, { environment: { tier: 'production' } });
client.initializeAsync().then(function () {
var arm = forced || client.getExperiment(EXPERIMENT).get('arm', null);
if (arm !== 'control' && arm !== 'variation') return;
var endsAt = Date.parse(client.getDynamicConfig(CONFIG).get('ends_at', ''));
render(arm, isNaN(endsAt) ? null : endsAt);
trackExposure(arm);
}).catch(function () { /* no banner */ });
});
}
if (document.body) start();
else document.addEventListener('DOMContentLoaded', start);
})();