Conversion tracking card: goal rows showed 30 (the window length) instead of the goal's conversions

LinkSpin's partnerSummary returns conv = the count and convDays = the window in days; my.js preferred convDays, so every goal read "30" under Conversions (30 days). Now shows g.conv. Also: a goal without a default value (LinkSpin stores 0) no longer adds &value=0 to its snippets or shows 0 as its default. QA mock now matches the real contract (convDays = 30) and asserts the row counts (6, 1). my.js ?v=20261024ct.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-24 11:08:11 -05:00
parent bf5cf62caf
commit 13f3ff56f8
3 changed files with 8 additions and 7 deletions
+3 -3
View File
@@ -1075,7 +1075,7 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
function convSnips(host, g) {
const h = 'https://' + String(host || 'linkspin.app').replace(/^https?:\/\//, '').replace(/\/+$/, '');
const px = encodeURIComponent(g.px), goal = encodeURIComponent(g.name);
const val = g.value != null && g.value !== '' ? '&value=' + encodeURIComponent(g.value) : '';
const val = Number(g.value) > 0 ? '&value=' + encodeURIComponent(g.value) : ''; // a goal with no default value (LinkSpin stores 0) adds nothing
return {
landing: '<script async src="' + h + '/t.js?px=' + px + '"></' + 'script>',
img: '<img src="' + h + '/cv.gif?px=' + px + '&goal=' + goal + val + '" width="1" height="1" alt="" style="display:none">',
@@ -1115,9 +1115,9 @@ function shareLink(ref) { return SHARE_DOMAIN && /^[A-Za-z0-9_]{1,40}$/.test(Str
const when = ts => ts ? new Date(ts).toLocaleString([], { month: 'short', day: 'numeric', hour: 'numeric', minute: '2-digit' }) : 'never';
list.innerHTML = '<div class="tablewrap"><table class="camp-table"><thead><tr><th>Goal</th><th class="num">Default value</th><th>Pixel id</th><th class="num">Conversions (30 days)</th><th>Last test</th><th></th></tr></thead><tbody>'
+ goals.map(g => '<tr' + (g.px === convSel ? ' style="background:rgba(120,160,255,.08)"' : '') + '><td data-l="Goal"><b>' + esc(g.name) + '</b></td>'
+ '<td class="num" data-l="Default value">' + (g.value != null && g.value !== '' ? esc(g.value) : '<span class="muted">none</span>') + '</td>'
+ '<td class="num" data-l="Default value">' + (Number(g.value) > 0 ? esc(g.value) : '<span class="muted">none</span>') + '</td>'
+ '<td data-l="Pixel id" class="mono small">' + esc(g.px) + '</td>'
+ '<td class="num" data-l="Conversions (30 days)">' + Number(g.convDays != null ? g.convDays : g.conv || 0).toLocaleString() + (g.lastAt ? '<div class="muted small">last ' + when(g.lastAt) + '</div>' : '') + '</td>'
+ '<td class="num" data-l="Conversions (30 days)">' + Number(g.conv || 0).toLocaleString() + (g.lastAt ? '<div class="muted small">last ' + when(g.lastAt) + '</div>' : '') + '</td>'
+ '<td data-l="Last test" class="small">' + when(g.lastTest) + '</td>'
+ '<td class="act"><button class="btn small sec" type="button" data-convpick="' + esc(g.px) + '">Snippets</button> <button class="btn small sec" type="button" data-convtest="' + esc(g.px) + '">Send a test conversion</button> <button class="btn small quiet" type="button" data-convdel="' + esc(g.px) + '" data-convname="' + esc(g.name) + '">Remove</button></td></tr>').join('')
+ '</tbody></table></div>';