add hidden UTM fields, capture from URL params, send in webhook

This commit is contained in:
Oliver
2026-06-07 18:26:15 -03:00
parent 639395d641
commit 87cff62ae3
+19
View File
@@ -1819,6 +1819,11 @@
<option value="france">France</option> <option value="france">France</option>
</select> </select>
<input type="text" class="pricing-config-input" id="pricing-coupon" placeholder="Coupon code" /> <input type="text" class="pricing-config-input" id="pricing-coupon" placeholder="Coupon code" />
<input type="hidden" id="utm_source" />
<input type="hidden" id="utm_medium" />
<input type="hidden" id="utm_campaign" />
<input type="hidden" id="utm_term" />
<input type="hidden" id="utm_content" />
</div> </div>
<!-- ── Plans grid ── --> <!-- ── Plans grid ── -->
@@ -2343,6 +2348,15 @@
document.getElementById('pricing-period').addEventListener('change', updatePeriodDisplay); document.getElementById('pricing-period').addEventListener('change', updatePeriodDisplay);
updatePeriodDisplay(); // fire on load so yearly bonuses show by default updatePeriodDisplay(); // fire on load so yearly bonuses show by default
/* ── Capture UTM params from URL ──────────────────────────── */
(function () {
const params = new URLSearchParams(window.location.search);
['source', 'medium', 'campaign', 'term', 'content'].forEach(function (key) {
const val = params.get('utm_' + key);
if (val) document.getElementById('utm_' + key).value = val;
});
})();
/* ── Hire Agent Webhook ───────────────────────────── */ /* ── Hire Agent Webhook ───────────────────────────── */
const ORDER_WEBHOOK = "https://n8n.derez.ai/webhook/5318a0d8-d064-42fb-95b7-aa5552cb3fa9"; const ORDER_WEBHOOK = "https://n8n.derez.ai/webhook/5318a0d8-d064-42fb-95b7-aa5552cb3fa9";
@@ -2362,6 +2376,11 @@
period: period, period: period,
location: location, location: location,
coupon: coupon || null, coupon: coupon || null,
utm_source: document.getElementById('utm_source').value || null,
utm_medium: document.getElementById('utm_medium').value || null,
utm_campaign: document.getElementById('utm_campaign').value || null,
utm_term: document.getElementById('utm_term').value || null,
utm_content: document.getElementById('utm_content').value || null,
}), }),
}); });
} catch (err) { } catch (err) {