Overview
To accurately attribute leads in Elementor, you need to capture the LeadJourney Click ID and submit it through your form.
This Click ID links the original ad click to your CRM data—allowing precise offline conversion tracking and ad platform optimization.
This guide shows you how to:
✅ Add a hidden field to your Elementor Form
✅ Automatically insert the lj_click_id
using JavaScript
✅ Ensure tracking works even with dynamically loaded forms or popups
Step 1: Add a Hidden Field to Your Elementor Form
Open your WordPress Dashboard, then edit the page with your Elementor form.
Click into the Form Widget.
Add a new Hidden Field:
Field Label: (optional, e.g. LeadJourney Click ID)
Field ID:
lj_click_id
Field Name:
lj_click_id
Default Value:
{lj_click_id}
💾 Save and update your page.
Step 2: Add the JavaScript to Insert the Click ID
Elementor loads forms dynamically—including in popups—so we use a custom script to reliably inject the Click ID.
✅ Use the Following Script:
<script type="text/javascript"> async function getClickId(maxWait = 8000, poll = 250) { const t0 = Date.now(); while (Date.now() - t0 < maxWait) { if (window.lj?.getClickId && typeof window.lj.getClickId === 'function') { try { const id = await window.lj.getClickId(); if (id && typeof id === 'string') { localStorage.setItem('clickid', id); return id; } } catch {} } const ls = localStorage.getItem('clickid'); if (ls) return ls; await new Promise(r => setTimeout(r, poll)); } return null; } function fillAllFields(id) { document .querySelectorAll('input[name="form_fields[lj_click_id]"]') .forEach(input => { input.value = input.value && input.value !== '{lj_click_id}' ? input.value : id; }); } async function ensureClickId() { const id = await getClickId(); if (!id) return console.warn('Keine Click-ID gefunden.'); fillAllFields(id); const tEnd = Date.now() + 5000; const obs = new MutationObserver(() => { fillAllFields(id); if (Date.now() > tEnd) obs.disconnect(); }); obs.observe(document.body, { childList: true, subtree: false }); } document.addEventListener('DOMContentLoaded', () => { ensureClickId(); document.querySelectorAll('form').forEach(form => { form.addEventListener('submit', async e => { const id = await getClickId(); if (!id) return; form .querySelectorAll('input[name="form_fields[lj_click_id]"]') .forEach(i => (i.value = id)); }, true); }); }); window.addEventListener('load', () => { window.elementorFrontend?.hooks?.addAction( 'frontend/element_ready/form', ensureClickId ); }); jQuery(document).on('elementor/popup/show', function () { ensureClickId(); }); </script>
📌 Place This Script:
Inside Elementor’s Custom Code section
Or via a plugin like Code Snippets
Avoid direct theme editing unless you're a developer
Step 3: Test Your Setup
Open your form page and press F12 to open the Developer Console.
Reload the page. Look for logs like:
"Click ID found:"
"Click ID successfully inserted:"
Submit the form and confirm
lj_click_id
was included in the submission.
Troubleshooting Tips
🚨 Click ID not showing?
✔ Make sure your field name is exactly lj_click_id
✔ Check console for JavaScript errors
✔ Try disabling caching or optimization plugins temporarily
🚨 {lj_click_id} not replaced?
✔ This is expected—our script replaces it at runtime
✔ Confirm the field loads after DOM ready (especially for popups or AJAX forms)
🚨 Form not sending the ID?
✔ Inspect the form HTML—ensure the name attribute is form_fields[lj_click_id]
Final Thoughts
Once implemented, this setup ensures reliable attribution for your Elementor Forms and LeadJourney:
✅ 98%+ tracking accuracy
✅ Fully GDPR-compliant (no cookies or personal data)
✅ Supports both static and dynamically-loaded forms
🚀 You’re now ready to track smarter with LeadJourney and Elementor!