Skip to main content

2.6 How to capture and parse the LeadJourney Click ID in a hidden field with every CMS

Jonas Strambach avatar
Written by Jonas Strambach
Updated this week

After creating a hidden field in your website form, the next step is to automatically insert the visitor’s Click ID into that field.

This ensures every lead captured through your form can be matched back to the original ad click — which is essential for offline conversion tracking and optimizing ad performance.


🧠 What This Step Does

LeadJourney assigns a unique Click ID to every visitor.
To use it for attribution, the Click ID must be:

  • Extracted via JavaScript from the LeadJourney tracking script

  • Parsed into a hidden form field named lj_click_id before the form is submitted


⚠️ Important: Implementation Depends on Your CMS

Depending on your CMS or website builder, script behavior can vary — especially with dynamically loaded or AJAX forms.

You may need a developer’s help to implement a version that works reliably across all pages, devices, and loading states.

It is critical that 100% of Click IDs are captured and parsed correctly
Be sure to test thoroughly to avoid any data loss.


🧑‍💻 Universal JavaScript Snippet (Base Version)

This base version works for most standard CMS setups:

<script> document.addEventListener("DOMContentLoaded", function () { function setClickId(clickid) { let input = document.querySelector('input[name="lj_click_id"]'); if (input) { input.value = clickid; } } function getClickId() { return window.lj ? window.lj.getClickId() : null; } function insertClickId() { const clickId = getClickId(); if (clickId) { setClickId(clickId); } } insertClickId(); const observer = new MutationObserver(insertClickId); observer.observe(document.body, { childList: true, subtree: true }); }); </script>

📌 Add this snippet in the <head> or global script area of your site.


🌐 Platform-Specific Example: WordPress + Elementor

For Elementor, dynamic rendering can delay form field availability.
Use this reliable script variant:

➕ To implement:

  1. Add a hidden field to your Elementor form

    • Field ID / Name: lj_click_id

    • Default Value: {lj_click_id}

  2. Paste the tailored script using Elementor’s Custom Code tool, or use a plugin like Insert Headers and Footers


🛠 Support for Other CMS Platforms

We are expanding platform-optimized scripts to ensure universal compatibility.
Supported and planned platforms include:

  • Webflow

  • Shopify

  • Wix

  • HubSpot

  • Squarespace

  • Custom-coded websites

💬 If your CMS isn’t listed, reach out to our support team — we’ll help you create a tailored solution.


🧠 Summary

Capturing the Click ID in a hidden form field (lj_click_id) is one of the most important setup steps in LeadJourney.

It enables you to:

✅ Match form submissions to ad clicks
✅ Unlock offline conversion tracking
✅ Push real lead data back to Meta & Google Ads


Need help or want a developer-optimized version for your platform?


📩 Contact our support — we’ll make sure your setup is bulletproof.

Did this answer your question?