// LinkSpin Traffic guide page (2026-10-28): offer picker, the ad formats, the networks, ground rules.
(function () {
const G = window.TRAFFIC_GUIDE, $ = id => document.getElementById(id), esc = CR.esc;
CR.mount({ active: 'sources', crumb: 'Control room ยท Sources', title: 'Traffic guide', sub: 'which traffic for which offer', actions: '← Sources' });
let CAT = [], OFF = null, NF = '';
const nameOf = k => { const c = CAT.find(x => x.key === k); return c ? c.name : k; };
const ORDER = ['best', 'good', 'weak', 'avoid'];
function tags(k) {
const n = G.NETWORKS[k] || { f: [] };
return n.f.map(f => '' + esc(G.fmtName(f)) + '').join('')
+ (n.adult === 'adult' ? 'adult sites' : n.adult === 'mixed' ? 'adult-heavy' : '')
+ (n.strict ? 'strict policy' : '');
}
function renderOffers() {
$('offers').innerHTML = G.OFFERS.map(o => '').join('');
$('offers').querySelectorAll('.chip').forEach(b => b.addEventListener('click', () => { OFF = OFF === b.dataset.k ? null : b.dataset.k; try { history.replaceState(null, '', OFF ? '#' + OFF : location.pathname); } catch (e) {} renderOffers(); renderResult(); }));
}
function renderResult() {
const o = G.OFFERS.find(x => x.key === OFF);
if (!o) { $('result').innerHTML = '
Pick one above.
'; return; }
const rows = Object.keys(o.fit).sort((a, b) => ORDER.indexOf(o.fit[a][0]) - ORDER.indexOf(o.fit[b][0]));
const good = rows.filter(f => o.fit[f][0] === 'best' || o.fit[f][0] === 'good');
// networks that sell at least one best/good format; strict-policy networks are left out for the opportunity offer
// adult-only sites suit few offers
const nets = Object.keys(G.NETWORKS).filter(k => { const n = G.NETWORKS[k]; if (n.strict && o.key === 'opp') return false; if (n.adult === 'adult' && !['games', 'sweeps'].includes(o.key)) return false; return n.f.some(f => good.includes(f)); })
.map(k => ({ k, score: G.NETWORKS[k].f.reduce((s, f) => s + (o.fit[f] ? (o.fit[f][0] === 'best' ? 3 : o.fit[f][0] === 'good' ? 1 : 0) : 0), 0) }))
.sort((a, b) => b.score - a.score || nameOf(a.k).localeCompare(nameOf(b.k)));
$('result').innerHTML = ''
+ rows.map(f => '
' + esc(G.FORMATS[f].name) + '' + o.fit[f][0] + '' + esc(o.fit[f][1]) + '
').join('')
+ '
Tip. ' + esc(o.tip) + '
'
+ '
Networks that sell those formats
'
+ (o.key === 'opp' ? '
Google, Microsoft, Facebook, Taboola, Revcontent and MGID are left out: their policies restrict crypto and income offers.
' : '')
+ '
';
}
function renderFormats() {
$('fmts').innerHTML = Object.keys(G.FORMATS).map(k => { const f = G.FORMATS[k];
return '' + esc(f.name) + '
' + esc(f.what) + '
How you pay: ' + esc(f.buy) + '
Converts: ' + esc(f.wins) + '
Struggles: ' + esc(f.fails) + '
Landing page: ' + esc(f.page) + '
'; }).join('');
}
function renderNets() {
const fs = Object.keys(G.FORMATS);
$('nfilter').innerHTML = '' + fs.map(f => '').join('');
$('nfilter').querySelectorAll('.chip').forEach(b => b.addEventListener('click', () => { NF = b.dataset.f; renderNets(); }));
const keys = Array.from(new Set(CAT.map(c => c.key).concat(Object.keys(G.NETWORKS)))).filter(k => !NF || ((G.NETWORKS[k] || {}).f || []).includes(NF)).sort((a, b) => nameOf(a).localeCompare(nameOf(b)));
$('nrows').innerHTML = keys.length ? keys.map(k => { const n = G.NETWORKS[k] || { f: [] }, c = CAT.find(x => x.key === k) || {}, bf = G.bestFor(k);
return '' + esc(nameOf(k)) + '' + esc(c.site || '') + '
' + (tags(k) || 'check in your account') + '
'
+ '
' + (bf.length ? 'Best for: ' + esc(bf.join(', ')) + '. ' : '') + esc(n.note || '') + '
'; }).join('')
: 'No network sells that format.
';
}
$('rules').innerHTML = G.RULES.map(r => '' + esc(r[0]) + '' + esc(r[1]) + '
').join('');
OFF = (location.hash.slice(1) && G.OFFERS.some(o => o.key === location.hash.slice(1))) ? location.hash.slice(1) : null;
renderOffers(); renderResult(); renderFormats(); renderNets();
CR.get('/api/sources/catalog').then(r => { CAT = r.catalog || []; renderResult(); renderNets(); }).catch(() => {});
})();