Repository navigation
LeadForge subid validation
As of ORB-011, LeadForge no longer fabricates subids for leads with no verifiable click context. This prevents the "Click ID not found in database" error on postbacks when leads are submitted from preview routes or with stale cookies.
- When no subid was found in request/cookies/session/query string, LeadForge would invent one:
lead_<random> - This invented subid was sent to the affiliate network
- The network's postback would fail with "Click ID not found in database" because the click never existed
- A subid is either a real
clicks.idor it is absent - Before sending a lead to the network, the subid is verified against the
clickstable (tri-state verification) - If verification confirms the click doesn't exist, the lead is rejected with a 422 error
- Stale cookies pointing to deleted clicks are treated as invalid
- Remote deployments without database access are handled gracefully (allow with warning)
lf_verify_click_exists() returns a tri-state to handle different scenarios:
| Return Value | Meaning | Action |
|---|---|---|
true |
Subid verified and exists in clicks table |
Allow - valid click context |
false |
Subid does NOT exist (verified against DB) | Reject - invalid click (stale/missing) |
null |
Cannot verify (no DB available) | Allow - remote deployment, log warning |
This tri-state approach ensures:
- Local tracker deployments reject invalid clicks
- Remote deployments (bundles on external hosting) continue to work without database access
- All non-verifiable cases are logged for visibility
A lead will be rejected with HTTP 422 in these cases:
-
No click context (
empty subid): Submitted from/offers/<id>/or/lander/<slug>/preview routes without entering through a campaign link -
Stale cookie: The
orbitra_clickcookie contains a click ID that no longer exists in the database (e.g., after a database reset or retention purge) -
Invalid subid: The subid from any source doesn't match any row in the
clickstable
Note: Remote deployments without database access will NOT reject leads - they will proceed with a warning logged to system_logs.
QA mode is exempt from subid verification:
- Leads with
orbitra_qa=1or subid starting withqa_test_bypass verification - These are explicitly for testing and are managed by the
runQamechanism
When a lead is rejected (invalid click context), the customer sees:
Unable to process your order. Please contact customer service or try again later.
This neutral message avoids exposing internal diagnostics (QA flags, preview routes, etc.) to end users.
Two types of events are logged to system_logs:
{
"level": "warning",
"message": "LeadForge: Lead rejected due to invalid click context",
"context": {
"reason": "Subid does not correspond to a real click (stale cookie or invalid subid)",
"subid": "b3ebefb2-db23-4541-a83a-d049d5f9d07f",
"ip": "87.232.72.54",
"offer_id": "123"
}
}{
"level": "warning",
"message": "LeadForge: Subid could not be verified (no database available)",
"context": {
"subid": "b3ebefb2-db23-4541-a83a-d049d5f9d07f",
"ip": "87.232.72.54",
"offer_id": "123",
"context": "remote_deployment_or_db_unavailable"
}
}- Clear cookies (important:
orbitra_clickpersists 24 hours) - Enter through the campaign link:
http://<host>/<campaign_alias> - Follow through to the landing page
- Submit the form
- Opening
/offers/<id>/directly - this is a preview route with no click context - Submitting with a stale cookie from a deleted click
Use the QA mode flag for testing without a real click:
<input type="hidden" name="orbitra_qa" value="1">Bundles deployed to external hosts without database access will:
- Accept leads (subid cannot be verified, not invalid)
- Log warnings to system_logs (if available) or continue silently
- Not show errors to customers
-
core/LeadForge.phpline 1155:$subid = 'lead_' . bin2hex(random_bytes(8));- subid fabrication fallback
-
lf_verify_click_exists($subid): Tri-state verification againstclickstable (returnstrue/false/null) -
lf_log_event($level, $message, $context): Logs tosystem_logs - Verification logic before network call:
-
true→ allow -
false→ reject with neutral customer message -
null→ allow with warning log
-
Вики собирается из папки docs/ репозитория. Правки — через pull request в docs/.
Getting started
Traffic
- Campaigns & streams
- Cloaking
- Landing pages
- Tracking Client (PHP)
- PWA & Web Push
- PWA Funnel
- Content gallery
Conversions & money
Analytics
Infrastructure
Management
For developers