Skip to content

Marketing skills for Claude Code and AI agents. CRO, copywriting, SEO, analytics, and growth engineering.

Replace the Wix Forms listener with the live-checked one

Aaron Beasheld26a3b846e6a
diff --git a/VERSIONS.md b/VERSIONS.md
index 5bf8f75..1fca09d 100644
--- a/VERSIONS.md
+++ b/VERSIONS.md
@@ -63,7 +63,7 @@ Current versions of all skills. Agents can compare against local versions to che
- Added the **`conversion-tracking`** skill (1.0.0). Setting up, auditing, verifying and fixing the path from a conversion on a website to Google Ads, Meta, GA4, LinkedIn, TikTok and Microsoft Ads, for lead generation and ecommerce. Gives an orphaned job a home. Analytics listed conversion tracking as a trigger without covering it, attribution routed pixels and CAPI to ads, and ads held one reference file. Built on one distinction, that lead gen has to infer success from a browser signal while ecommerce reads it from an order record. Nine references (how each form, booking and chat tool signals success, the complete browser-side path, the server-side options with prices, ecommerce platforms including Shopify's 26 Aug 2026 Additional Scripts removal, Google Ads, Meta, other platforms, the audit playbook, and why the numbers never match), 22 detection snippets, importable GTM recipes merged by `scripts/build_recipe.py`, and 16 evals. Audit scoring follows the ads skill's audit guardrails, summarised inline. New skill = repo y release; total skills: 51. Contributed by Aaron Beashel (Converly ◆, a Verified Partner) and reviewed against the repo's partner-integrity bar before merge:
- **Neutrality:** free and native paths first (browser Enhanced Conversions, Meta advanced matching, Google tag gateway, Meta CAPI Gateway, tool webhooks); a "when server-side matters less" section; the partner row matches the others in length and lists its tradeoffs; a free-tier row in the side-by-side; paid options surface at the delivery decision, not in every answer; the contributor's other tool (Attributer) is disclosed with alternatives; five neutrality evals (ids 17–21) and one delivery-decision eval (id 22).
- **Facts:** browser tags can send hashed email and phone; Meta dropped the AEM 8-event cap in May 2023; Microsoft has a Conversions API (self-serve token, still rolling out); LinkedIn dedup needs a shared `eventId`; Meta CAPI for CRM gates; Google tROAS vs tCPA minimums; conversion-adjustment windows; Shopify's 1 Oct 2026 script-tag change; the undercount stated as a 10–30% range rather than a universal 30%.
- - **Assets:** 15 detection snippets replaced with listeners that passed live checks on real forms, Jotform's now firing on the completion message its iframe and script embeds send, and Framer's confirming through Framer's own form request; every GTM recipe uses Tag Manager's import format, so Import Container accepts it; 10 drifted GTM recipes regenerated from their snippets, with `scripts/check_recipes.py` to keep them in sync; `build_recipe.py` validates every ID and substitutes safely (no JSON or JS injection) on Python 3.8+; every send tag requires consent (the Google Ads conversion tag `ad_storage` only); snippet success-signal types documented.
+ - **Assets:** 16 detection snippets replaced with listeners that passed live checks on real forms, Jotform's now firing on the completion message its iframe and script embeds send, and Framer's confirming through Framer's own form request; every GTM recipe uses Tag Manager's import format, so Import Container accepts it; 10 drifted GTM recipes regenerated from their snippets, with `scripts/check_recipes.py` to keep them in sync; `build_recipe.py` validates every ID and substitutes safely (no JSON or JS injection) on Python 3.8+; every send tag requires consent (the Google Ads conversion tag `ad_storage` only); snippet success-signal types documented.
- **Repo fit:** operative rules in the description, a revops boundary, no cross-skill relative links, two audit checks restored from the retired ads reference.
- **Converly integration guide** filled in (capabilities, setup, operations); platform lift stats carry a holdout caveat.
- **analytics** (2.0.1 → 2.0.2): description drops the "conversion tracking" and "track conversions" triggers and hands getting conversions into ad platforms to conversion-tracking.
diff --git a/skills/conversion-tracking/assets/gtm-recipes/detect/detect-wix-forms.json b/skills/conversion-tracking/assets/gtm-recipes/detect/detect-wix-forms.json
index 431f0f1..7fe2ea6 100644
--- a/skills/conversion-tracking/assets/gtm-recipes/detect/detect-wix-forms.json
+++ b/skills/conversion-tracking/assets/gtm-recipes/detect/detect-wix-forms.json
@@ -29,7 +29,7 @@
{
"type": "TEMPLATE",
"key": "html",
- "value": "<script>\n(function () {\n if (window.__ctDetectWixForms) return;\n window.__ctDetectWixForms = true;\n window.dataLayer = window.dataLayer || [];\n\n // How long, after a New-form Submit click, we wait for a success signal\n // before giving up (treating it as a validation failure / no-op).\n var SUCCESS_WINDOW_MS = 7000;\n\n function fireConversion(formId) {\n window.dataLayer.push({\n event: 'wix_form_submitted',\n form_id: formId || ''\n });\n }\n\n // ---- Form detection ----\n\n // New Wix Forms carry data-hook markers: the form itself is\n // data-hook=\"form-<uuid>\", fields are wrapped in\n // data-hook=\"form-field-...\", and the submit control is\n // data-hook=\"submit-button\".\n function isNewWixForm(root) {\n if (!root) return false;\n try {\n var hook = root.getAttribute ? root.getAttribute('data-hook') : null;\n if (hook && hook.indexOf('form-') === 0 && hook.indexOf('form-field-') !== 0) {\n return true;\n }\n if (root.querySelector &&\n (root.querySelector('[data-hook^=\"form-field-\"]') ||\n root.querySelector('[data-hook=\"submit-button\"]'))) {\n return true;\n }\n } catch (e) {\n // fall through\n }\n return false;\n }\n\n // Old Wix Forms render inputs as Wix components: id=\"input_comp-...\".\n function isOldWixForm(formEl) {\n if (!formEl || !formEl.querySelector) return false;\n try {\n if (formEl.querySelector('input[id^=\"input_comp-\"]')) return true;\n } catch (e) {\n // fall through\n }\n return false;\n }\n\n // ---- OLD Wix forms: native submit (Pattern A) ----\n // Capture phase so this runs before Wix's own handler can clear/detach\n // the form. New forms are explicitly excluded — they have no native\n // submit and are handled by the click path below.\n function handleSubmit(event) {\n try {\n var formEl = event.target;\n if (!formEl || (formEl.tagName || '').toLowerCase() !== 'form') return;\n if (isNewWixForm(formEl)) return; // click path owns new forms\n if (!isOldWixForm(formEl)) return;\n\n // A submission another handler already cancelled never happened.\n if (event.defaultPrevented) return;\n\n // Constraint validation gate: an invalid form cannot have submitted.\n try {\n if (typeof formEl.checkValidity === 'function' && formEl.checkValidity() === false) return;\n } catch (e) {\n // constraint validation unavailable — fall through\n }\n\n fireConversion(formEl.id);\n } catch (e) {\n // Never throw back into Wix's own form handling.\n }\n }\n\n // ---- NEW Wix forms: submit-button click + confirmed success ----\n\n // Watchers currently in flight, keyed by form root, so duplicate click\n // events Wix emits for a single Submit press don't arm two watchers. A\n // re-click on a watched root REFRESHES the existing watcher instead of\n // being dropped, so a visitor who fails validation, fixes a field, and\n // clicks again inside the window gets a fresh verdict.\n var activeWatchers = [];\n\n function findWatcher(root) {\n for (var w = 0; w < activeWatchers.length; w++) {\n if (activeWatchers[w].root === root) return activeWatchers[w];\n }\n return null;\n }\n\n function findNewFormRoot(btn) {\n var root = btn.closest ? btn.closest('form') : null;\n if (root && isNewWixForm(root)) return root;\n if (btn.closest) {\n var alt = btn.closest('[data-hook=\"form-root\"]') || btn.closest('[data-hook^=\"form-\"]');\n if (alt && isNewWixForm(alt)) return alt;\n }\n return null;\n }\n\n // Sorts a candidate node into one of two evidence tiers:\n // 'structural' — a marker Wix's own runtime stamps on success (a\n // data-hook or class name containing \"success\") — sufficient alone.\n // 'status' — readable confirmation-ish text (ARIA live region or\n // English thank-you wording) — corroboration only, never sufficient\n // alone (live regions also announce in-progress states).\n // null — not evidence.\n function classifySuccessNode(node) {\n if (!node || node.nodeType !== 1) return null;\n try {\n var hook = node.getAttribute ? node.getAttribute('data-hook') : null;\n if (hook && /error/i.test(hook)) return null;\n if (node.getAttribute && node.getAttribute('aria-busy') === 'true') return null;\n var cls = (typeof node.className === 'string' ? node.className : '') || '';\n if (/error/i.test(cls)) return null;\n if ((hook && /success/i.test(hook)) || /success/i.test(cls)) return 'structural';\n var text = (node.textContent || '').trim();\n if (!text) return null;\n if (/error|required|invalid|try again|please enter|please fill/i.test(text)) return null;\n var isSuccessText =\n /thank|success|received|in touch|submitted|message sent|got it|appreciate|subscrib/i.test(text);\n if (!isSuccessText &&\n /^(submitting|sending|loading|processing|please wait|one moment)\\b/i.test(text)) {\n return null;\n }\n if (node.getAttribute && node.getAttribute('role') === 'status') return 'status';\n if (isSuccessText) return 'status';\n } catch (e) {\n // fall through\n }\n return null;\n }\n\n // Wix marks failed fields with an \"error\" data-hook slot and/or\n // aria-invalid=\"true\" on the input — visible ones mean the submit was\n // rejected.\n function isNodeHidden(el) {\n try {\n if (el.hidden) return true;\n if (el.getAttribute && el.getAttribute('aria-hidden') === 'true') return true;\n var view = el.ownerDocument && el.ownerDocument.defaultView;\n if (view && view.getComputedStyle) {\n var cs = view.getComputedStyle(el);\n if (cs && (cs.display === 'none' || cs.visibility === 'hidden')) return true;\n }\n } catch (e) {\n // fall through\n }\n return false;\n }\n\n // Ancestor-aware hiding check, capped at the observed container.\n function isConcealed(el, stopAt) {\n var node = el;\n var depth = 0;\n while (node && node.nodeType === 1 && depth < 12) {\n if (isNodeHidden(node)) return true;\n if (node === stopAt) break;\n node = node.parentNode;\n depth++;\n }\n return false;\n }\n\n function hasVisibleValidationErrors(root) {\n if (!root || !root.querySelectorAll) return false;\n try {\n var nodes = root.querySelectorAll('[data-hook*=\"error\"], [aria-invalid=\"true\"]');\n for (var i = 0; i < nodes.length; i++) {\n var node = nodes[i];\n if (isNodeHidden(node)) continue;\n if (node.getAttribute && node.getAttribute('aria-invalid') === 'true') return true;\n if ((node.textContent || '').trim()) return true;\n }\n } catch (e) {\n // fall through\n }\n return false;\n }\n\n function watchForSuccess(root, formId, pagehideTrusted) {\n var entry = { root: root, refresh: refresh };\n activeWatchers.push(entry);\n\n var fired = false;\n var timer = null;\n var observer = null;\n var pagehideArmed = false;\n // Corroboration state: a status/text confirmation was seen this\n // attempt. Text alone never fires — it only lets the weak structural\n // signals (form concealed / removed) confirm.\n var statusSeen = false;\n\n // Snapshot the controls that currently hold a value, so we can detect\n // Wix clearing the form on success. Values themselves are never read\n // for content — only used to test \"was non-empty, now empty\".\n var tracked = [];\n function snapshotTracked() {\n tracked = [];\n try {\n var inputs = root.querySelectorAll('input, textarea, select');\n for (var i = 0; i < inputs.length; i++) {\n var el = inputs[i];\n if ((el.type || '') === 'hidden') continue;\n if ((el.value || '') !== '') tracked.push(el);\n }\n } catch (e) {\n // fall through\n }\n }\n snapshotTracked();\n\n function armPagehide() {\n if (pagehideArmed) return;\n try {\n window.addEventListener('pagehide', onPageHide, true);\n pagehideArmed = true;\n } catch (e) {\n // fall through\n }\n }\n\n function disarmPagehide() {\n if (!pagehideArmed) return;\n try { window.removeEventListener('pagehide', onPageHide, true); } catch (e) {}\n pagehideArmed = false;\n }\n\n function startTimer() {\n if (timer) clearTimeout(timer);\n timer = setTimeout(function() {\n if (!fired) cleanup(); // no success signal within window — not firing\n }, SUCCESS_WINDOW_MS);\n }\n\n // A later click on the same root — Wix's duplicate click event for one\n // press, or a real re-submit after the visitor corrected a failed\n // field. Everything reflects the LATEST attempt.\n function refresh(nextFormId, nextPagehideTrusted) {\n if (fired) return;\n formId = nextFormId;\n statusSeen = false;\n snapshotTracked();\n if (nextPagehideTrusted) armPagehide();\n else disarmPagehide();\n startTimer();\n }\n\n function cleanup() {\n if (timer) { clearTimeout(timer); timer = null; }\n if (observer) { try { observer.disconnect(); } catch (e) {} observer = null; }\n disarmPagehide();\n var idx = activeWatchers.indexOf(entry);\n if (idx !== -1) activeWatchers.splice(idx, 1);\n }\n\n function fire() {\n if (fired) return;\n fired = true;\n fireConversion(formId);\n cleanup();\n }\n\n function inputsCleared() {\n if (!tracked.length) return false;\n for (var i = 0; i < tracked.length; i++) {\n var el = tracked[i];\n if (el && el.isConnected && (el.value || '') !== '') return false;\n }\n return true; // every previously-filled control is now empty or gone\n }\n\n function noteEvidence(node, structuralOnly) {\n if (!node || node === scope) return false;\n var tier = classifySuccessNode(node);\n if (tier === 'structural' && !isConcealed(node, scope)) {\n fire();\n return true;\n }\n if (!structuralOnly && tier === 'status') statusSeen = true;\n return false;\n }\n\n function onMutations(muts) {\n if (fired) return;\n var removed = !root.isConnected;\n if (!removed && inputsCleared()) { fire(); return; } // Wix reset the form\n for (var i = 0; i < muts.length; i++) {\n var added = muts[i].addedNodes || [];\n for (var j = 0; j < added.length; j++) {\n var node = added[j];\n if (noteEvidence(node, false)) return;\n if (node && node.nodeType === 3 && noteEvidence(muts[i].target, false)) return;\n }\n if (muts[i].type === 'attributes' && noteEvidence(muts[i].target, true)) return;\n }\n // Removal/concealment alone are too weak to fire — closing a modal or\n // an SPA page swap looks the same with no submit behind it. A\n // status/text message seen in the same attempt corroborates.\n if (statusSeen && (removed || isConcealed(root, scope))) {\n fire();\n }\n }\n\n function onPageHide() {\n // A visitor who failed Wix's validation and then left the page also\n // produces a pagehide — visible error indicators mean no submit\n // happened.\n if (hasVisibleValidationErrors(root)) return;\n fire();\n }\n\n // Scope the observer to the form's container — success messages appear\n // here and form removal shows up as a childList change on the parent.\n var scope = root.parentNode || document.body;\n try {\n observer = new MutationObserver(onMutations);\n observer.observe(scope, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class', 'hidden', 'aria-hidden'],\n });\n } catch (e) {\n // MutationObserver unavailable — rely on pagehide + timeout only\n }\n\n if (pagehideTrusted) armPagehide();\n\n startTimer();\n }\n\n function handleClick(event) {\n try {\n var target = event.target;\n if (!target || !target.closest) return;\n\n var btn = target.closest('[data-hook=\"submit-button\"]');\n if (!btn) return;\n\n var root = findNewFormRoot(btn);\n if (!root) return;\n\n var formId = root.getAttribute ? (root.getAttribute('data-hook') || root.id || '') : (root.id || '');\n\n // A form invalid under native constraint validation at click time\n // cannot have submitted, so a later pagehide must not confirm it.\n // Structural success signals stay armed regardless — they only ever\n // come from Wix itself, after an actual successful submit.\n var pagehideTrusted = true;\n try {\n if (typeof root.checkValidity === 'function' && !root.checkValidity()) {\n pagehideTrusted = false;\n }\n } catch (e) {\n // constraint validation unavailable\n }\n\n var existing = findWatcher(root);\n if (existing) {\n existing.refresh(formId, pagehideTrusted);\n return;\n }\n\n watchForSuccess(root, formId, pagehideTrusted);\n } catch (e) {\n // Never throw back into Wix's own click handling.\n }\n }\n\n if (typeof document !== 'undefined' && document.addEventListener) {\n // Bubble phase for submit: a capture-phase listener runs before Wix's own\n // handlers and would count submissions its validation goes on to cancel.\n document.addEventListener('submit', handleSubmit, false); // OLD forms\n document.addEventListener('click', handleClick, true); // NEW forms\n }\n})();\n</script>"
+ "value": "<script>\n(function () {\n if (window.__ctDetectWixForms) return;\n window.__ctDetectWixForms = true;\n window.dataLayer = window.dataLayer || [];\n\n // Wait for Wix's inline confirmation without reading form answers.\n var SUCCESS_WINDOW_MS = 60000;\n\n function fireConversion(formId) {\n window.dataLayer.push({\n event: 'wix_form_submitted',\n form_id: formId || ''\n });\n }\n\n // ---- Form detection ----\n\n // New Wix Forms carry data-hook markers: the form itself is\n // data-hook=\"form-<uuid>\", fields are wrapped in\n // data-hook=\"form-field-...\", and the submit control is\n // data-hook=\"submit-button\".\n function isNewWixForm(root) {\n if (!root) return false;\n try {\n var hook = root.getAttribute ? root.getAttribute('data-hook') : null;\n if (hook && hook.indexOf('form-') === 0 && hook.indexOf('form-field-') !== 0) {\n return true;\n }\n if (root.querySelector &&\n (root.querySelector('[data-hook^=\"form-field-\"]') ||\n root.querySelector('[data-hook=\"submit-button\"]'))) {\n return true;\n }\n } catch (e) {\n // fall through\n }\n return false;\n }\n\n // Legacy Forms have no observed accepted-only browser verdict in this pack.\n // Their native submit event is an attempt, so coverage is deliberately withheld.\n\n // New Wix Forms arm on a click and confirm with Wix's success marker.\n\n // Watchers currently in flight, keyed by form root, so duplicate click\n // events Wix emits for a single Submit press don't arm two watchers. A\n // re-click on a watched root REFRESHES the existing watcher instead of\n // being dropped, so a visitor who fails validation, fixes a field, and\n // clicks again inside the window gets a fresh verdict.\n var activeWatchers = [];\n\n function findWatcher(root) {\n for (var w = 0; w < activeWatchers.length; w++) {\n if (activeWatchers[w].root === root) return activeWatchers[w];\n }\n return null;\n }\n\n function findNewFormRoot(btn) {\n var root = btn.closest ? btn.closest('form') : null;\n if (root && isNewWixForm(root)) return root;\n if (btn.closest) {\n var alt = btn.closest('[data-hook=\"form-root\"]') || btn.closest('[data-hook^=\"form-\"]');\n if (alt && isNewWixForm(alt)) return alt;\n }\n return null;\n }\n\n // Wix FormViewerWidget renders this hook after its submission action\n // returns a submission. Generic classes and navigation are not acceptance.\n function classifySuccessNode(node) {\n if (!node || node.nodeType !== 1) return null;\n return node.getAttribute &&\n node.getAttribute('data-hook') === 'submit-form-success-message'\n ? 'structural' : null;\n }\n\n function isNodeHidden(el) {\n try {\n if (el.hidden) return true;\n if (el.getAttribute && el.getAttribute('aria-hidden') === 'true') return true;\n var view = el.ownerDocument && el.ownerDocument.defaultView;\n if (view && view.getComputedStyle) {\n var cs = view.getComputedStyle(el);\n if (cs && (cs.display === 'none' || cs.visibility === 'hidden')) return true;\n }\n } catch (e) {\n // fall through\n }\n return false;\n }\n\n // Ancestor-aware hiding check, capped at the observed container.\n function isConcealed(el, stopAt) {\n var node = el;\n var depth = 0;\n while (node && node.nodeType === 1 && depth < 12) {\n if (isNodeHidden(node)) return true;\n if (node === stopAt) break;\n node = node.parentNode;\n depth++;\n }\n return false;\n }\n\n function watchForSuccess(root, formId) {\n var entry = { root: root, refresh: refresh, cancel: cleanup };\n activeWatchers.push(entry);\n\n var fired = false;\n var timer = null;\n var observer = null;\n function startTimer() {\n if (timer) clearTimeout(timer);\n timer = setTimeout(function() {\n if (!fired) cleanup(); // No success signal within the window.\n }, SUCCESS_WINDOW_MS);\n }\n\n // A later click on the same root can be a duplicate click event for one\n // press, or a real re-submit after the visitor corrected a failed\n // field. Everything reflects the LATEST attempt.\n function refresh(nextFormId) {\n if (fired) return;\n formId = nextFormId;\n startTimer();\n }\n\n function cleanup() {\n if (timer) { clearTimeout(timer); timer = null; }\n if (observer) { try { observer.disconnect(); } catch (e) {} observer = null; }\n var idx = activeWatchers.indexOf(entry);\n if (idx !== -1) activeWatchers.splice(idx, 1);\n discardMethod2(formId, root);\n }\n\n function fire() {\n if (fired) return;\n fired = true;\n var handled = false;\n try {\n if (typeof window.__ctWixMethod2Emit === 'function') {\n handled = window.__ctWixMethod2Emit(formId, root) === true;\n }\n } catch (e) {}\n if (!handled) fireConversion(formId);\n cleanup();\n }\n\n function noteEvidence(node) {\n if (!node || node === scope) return false;\n if (classifySuccessNode(node) === 'structural' && !isConcealed(node, scope)) {\n fire();\n return true;\n }\n if (node.querySelectorAll) {\n var markers = node.querySelectorAll('[data-hook=\"submit-form-success-message\"]');\n for (var i = 0; i < markers.length; i++) {\n if (noteEvidence(markers[i])) return true;\n }\n }\n return false;\n }\n\n function onMutations(muts) {\n if (fired) return;\n for (var i = 0; i < muts.length; i++) {\n var added = muts[i].addedNodes || [];\n for (var j = 0; j < added.length; j++) {\n var node = added[j];\n if (noteEvidence(node)) return;\n }\n }\n }\n\n // The inline confirmation belongs to this form only.\n var scope = root;\n try {\n observer = new MutationObserver(onMutations);\n observer.observe(scope, {\n childList: true,\n subtree: true\n });\n } catch (e) {\n // Without observation, no conversion is inferred.\n }\n\n startTimer();\n }\n\n function handleClick(event) {\n try {\n var target = event.target;\n if (!target || !target.closest) return;\n\n var btn = target.closest('[data-hook=\"submit-button\"]');\n if (!btn) return;\n\n var root = findNewFormRoot(btn);\n if (!root) return;\n\n var formId = root.getAttribute ? (root.getAttribute('data-hook') || root.id || '') : (root.id || '');\n\n var existing = findWatcher(root);\n if (existing) {\n existing.refresh(formId);\n return;\n }\n\n watchForSuccess(root, formId);\n } catch (e) {\n // Never throw back into Wix's own click handling.\n }\n }\n\n if (typeof document !== 'undefined' && document.addEventListener) {\n document.addEventListener('click', handleClick, true); // NEW forms\n }\n\n function discardMethod2(formId, root) {\n try {\n if (typeof window.__ctWixMethod2Discard === 'function') {\n window.__ctWixMethod2Discard(formId, root);\n }\n } catch (e) {}\n }\n})();\n</script>"
},
{
"type": "BOOLEAN",
@@ -100,4 +100,4 @@
"fingerprint": "0",
"tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/0/containers/0/workspaces/0"
}
-}
+}
\ No newline at end of file
diff --git a/skills/conversion-tracking/assets/snippets/README.md b/skills/conversion-tracking/assets/snippets/README.md
index a34498f..f390510 100644
--- a/skills/conversion-tracking/assets/snippets/README.md
+++ b/skills/conversion-tracking/assets/snippets/README.md
@@ -73,7 +73,7 @@ Not every snippet fires on a confirmed success. Some tools expose no success sig
| `tally.js` | Native success event | `Tally.FormSubmitted` postMessage from `https://tally.so`, accepted only from a loaded `tally.so/embed`, `/r` or `/popup` iframe for the same form ID, with a submission `id` and a `fields` array; once per form and submission ID |
| `typeform.js` | Native success event | `form-submit` postMessage from typeform.com carrying `formId` and `responseId` |
| `webflow-forms.js` | DOM-inferred after submit | submit on a form in `.w-form`, then within 30s `.w-form-done` becomes visible, or Webflow's own form state shows a redirect with `success === true` (checked on jQuery `ajaxComplete`); a newly shown `.w-form-fail` or the timeout cancels, and a resubmit replaces the pending watch |
-| `wix-forms.js` | DOM-inferred after submit (new forms); submit/click-based best effort (old forms) | new: Submit click, then a success status/cleared form with no visible errors within 7s, or a page unload after a valid click; old: `submit` passing `checkValidity()` |
+| `wix-forms.js` | DOM-inferred after submit | click on a current Wix form's `[data-hook="submit-button"]`, then within 60s Wix's own thank-you message (`[data-hook="submit-form-success-message"]`) is added inside that form; a second click refreshes the same watch. Older Wix contact forms and forms set to redirect after submit are not covered |
| `wix-scheduling.js` | DOM-inferred after submit | Book Now click stored in localStorage, then the `ThankYouPageAppDataHook.root` confirmation page renders within 10 minutes |
| `wpforms.js` | Native success event (AJAX); DOM-inferred after submit (non-AJAX) | jQuery `wpformsAjaxSubmitSuccess` followed by a new `#wpforms-confirmation-<id>` node (once per node), or `wpformsAjaxSubmitBeforeRedirect`; non-AJAX: leaving the page within 10s of submit with no client validation errors stores a sessionStorage marker, then within 120s the next page shows `#wpforms-confirmation-<id>` or a different path, with no `.wpforms-error` / `[aria-invalid]` markers |
| `ws-form.js` | Native success event | jQuery `wsf-submit-success` on a `form.wsf-form` with a numeric form ID; repeats for the same form and instance within 2s count once |
diff --git a/skills/conversion-tracking/assets/snippets/wix-forms.js b/skills/conversion-tracking/assets/snippets/wix-forms.js
index 92ddd02..3ca6ad9 100644
--- a/skills/conversion-tracking/assets/snippets/wix-forms.js
+++ b/skills/conversion-tracking/assets/snippets/wix-forms.js
@@ -6,9 +6,8 @@
window.__ctDetectWixForms = true;
window.dataLayer = window.dataLayer || [];
- // How long, after a New-form Submit click, we wait for a success signal
- // before giving up (treating it as a validation failure / no-op).
- var SUCCESS_WINDOW_MS = 7000;
+ // Wait for Wix's inline confirmation without reading form answers.
+ var SUCCESS_WINDOW_MS = 60000;
function fireConversion(formId) {
window.dataLayer.push({
@@ -41,45 +40,10 @@
return false;
}
- // Old Wix Forms render inputs as Wix components: id="input_comp-...".
- function isOldWixForm(formEl) {
- if (!formEl || !formEl.querySelector) return false;
- try {
- if (formEl.querySelector('input[id^="input_comp-"]')) return true;
- } catch (e) {
- // fall through
- }
- return false;
- }
-
- // ---- OLD Wix forms: native submit (Pattern A) ----
- // Capture phase so this runs before Wix's own handler can clear/detach
- // the form. New forms are explicitly excluded — they have no native
- // submit and are handled by the click path below.
- function handleSubmit(event) {
- try {
- var formEl = event.target;
- if (!formEl || (formEl.tagName || '').toLowerCase() !== 'form') return;
- if (isNewWixForm(formEl)) return; // click path owns new forms
- if (!isOldWixForm(formEl)) return;
-
- // A submission another handler already cancelled never happened.
- if (event.defaultPrevented) return;
-
- // Constraint validation gate: an invalid form cannot have submitted.
- try {
- if (typeof formEl.checkValidity === 'function' && formEl.checkValidity() === false) return;
- } catch (e) {
- // constraint validation unavailable — fall through
- }
-
- fireConversion(formEl.id);
- } catch (e) {
- // Never throw back into Wix's own form handling.
- }
- }
+ // Legacy Forms have no observed accepted-only browser verdict in this pack.
+ // Their native submit event is an attempt, so coverage is deliberately withheld.
- // ---- NEW Wix forms: submit-button click + confirmed success ----
+ // New Wix Forms arm on a click and confirm with Wix's success marker.
// Watchers currently in flight, keyed by form root, so duplicate click
// events Wix emits for a single Submit press don't arm two watchers. A
@@ -105,42 +69,15 @@
return null;
}
- // Sorts a candidate node into one of two evidence tiers:
- // 'structural' — a marker Wix's own runtime stamps on success (a
- // data-hook or class name containing "success") — sufficient alone.
- // 'status' — readable confirmation-ish text (ARIA live region or
- // English thank-you wording) — corroboration only, never sufficient
- // alone (live regions also announce in-progress states).
- // null — not evidence.
+ // Wix FormViewerWidget renders this hook after its submission action
+ // returns a submission. Generic classes and navigation are not acceptance.
function classifySuccessNode(node) {
if (!node || node.nodeType !== 1) return null;
- try {
- var hook = node.getAttribute ? node.getAttribute('data-hook') : null;
- if (hook && /error/i.test(hook)) return null;
- if (node.getAttribute && node.getAttribute('aria-busy') === 'true') return null;
- var cls = (typeof node.className === 'string' ? node.className : '') || '';
- if (/error/i.test(cls)) return null;
- if ((hook && /success/i.test(hook)) || /success/i.test(cls)) return 'structural';
- var text = (node.textContent || '').trim();
- if (!text) return null;
- if (/error|required|invalid|try again|please enter|please fill/i.test(text)) return null;
- var isSuccessText =
- /thank|success|received|in touch|submitted|message sent|got it|appreciate|subscrib/i.test(text);
- if (!isSuccessText &&
- /^(submitting|sending|loading|processing|please wait|one moment)\b/i.test(text)) {
- return null;
- }
- if (node.getAttribute && node.getAttribute('role') === 'status') return 'status';
- if (isSuccessText) return 'status';
- } catch (e) {
- // fall through
- }
- return null;
+ return node.getAttribute &&
+ node.getAttribute('data-hook') === 'submit-form-success-message'
+ ? 'structural' : null;
}
- // Wix marks failed fields with an "error" data-hook slot and/or
- // aria-invalid="true" on the input — visible ones mean the submit was
- // rejected.
function isNodeHidden(el) {
try {
if (el.hidden) return true;
@@ -169,171 +106,88 @@
return false;
}
- function hasVisibleValidationErrors(root) {
- if (!root || !root.querySelectorAll) return false;
- try {
- var nodes = root.querySelectorAll('[data-hook*="error"], [aria-invalid="true"]');
- for (var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- if (isNodeHidden(node)) continue;
- if (node.getAttribute && node.getAttribute('aria-invalid') === 'true') return true;
- if ((node.textContent || '').trim()) return true;
- }
- } catch (e) {
- // fall through
- }
- return false;
- }
-
- function watchForSuccess(root, formId, pagehideTrusted) {
- var entry = { root: root, refresh: refresh };
+ function watchForSuccess(root, formId) {
+ var entry = { root: root, refresh: refresh, cancel: cleanup };
activeWatchers.push(entry);
var fired = false;
var timer = null;
var observer = null;
- var pagehideArmed = false;
- // Corroboration state: a status/text confirmation was seen this
- // attempt. Text alone never fires — it only lets the weak structural
- // signals (form concealed / removed) confirm.
- var statusSeen = false;
-
- // Snapshot the controls that currently hold a value, so we can detect
- // Wix clearing the form on success. Values themselves are never read
- // for content — only used to test "was non-empty, now empty".
- var tracked = [];
- function snapshotTracked() {
- tracked = [];
- try {
- var inputs = root.querySelectorAll('input, textarea, select');
- for (var i = 0; i < inputs.length; i++) {
- var el = inputs[i];
- if ((el.type || '') === 'hidden') continue;
- if ((el.value || '') !== '') tracked.push(el);
- }
- } catch (e) {
- // fall through
- }
- }
- snapshotTracked();
-
- function armPagehide() {
- if (pagehideArmed) return;
- try {
- window.addEventListener('pagehide', onPageHide, true);
- pagehideArmed = true;
- } catch (e) {
- // fall through
- }
- }
-
- function disarmPagehide() {
- if (!pagehideArmed) return;
- try { window.removeEventListener('pagehide', onPageHide, true); } catch (e) {}
- pagehideArmed = false;
- }
-
function startTimer() {
if (timer) clearTimeout(timer);
timer = setTimeout(function() {
- if (!fired) cleanup(); // no success signal within window — not firing
+ if (!fired) cleanup(); // No success signal within the window.
}, SUCCESS_WINDOW_MS);
}
- // A later click on the same root — Wix's duplicate click event for one
+ // A later click on the same root can be a duplicate click event for one
// press, or a real re-submit after the visitor corrected a failed
// field. Everything reflects the LATEST attempt.
- function refresh(nextFormId, nextPagehideTrusted) {
+ function refresh(nextFormId) {
if (fired) return;
formId = nextFormId;
- statusSeen = false;
- snapshotTracked();
- if (nextPagehideTrusted) armPagehide();
- else disarmPagehide();
startTimer();
}
function cleanup() {
if (timer) { clearTimeout(timer); timer = null; }
if (observer) { try { observer.disconnect(); } catch (e) {} observer = null; }
- disarmPagehide();
var idx = activeWatchers.indexOf(entry);
if (idx !== -1) activeWatchers.splice(idx, 1);
+ discardMethod2(formId, root);
}
function fire() {
if (fired) return;
fired = true;
- fireConversion(formId);
+ var handled = false;
+ try {
+ if (typeof window.__ctWixMethod2Emit === 'function') {
+ handled = window.__ctWixMethod2Emit(formId, root) === true;
+ }
+ } catch (e) {}
+ if (!handled) fireConversion(formId);
cleanup();
}
- function inputsCleared() {
- if (!tracked.length) return false;
- for (var i = 0; i < tracked.length; i++) {
- var el = tracked[i];
- if (el && el.isConnected && (el.value || '') !== '') return false;
- }
- return true; // every previously-filled control is now empty or gone
- }
-
- function noteEvidence(node, structuralOnly) {
+ function noteEvidence(node) {
if (!node || node === scope) return false;
- var tier = classifySuccessNode(node);
- if (tier === 'structural' && !isConcealed(node, scope)) {
+ if (classifySuccessNode(node) === 'structural' && !isConcealed(node, scope)) {
fire();
return true;
}
- if (!structuralOnly && tier === 'status') statusSeen = true;
+ if (node.querySelectorAll) {
+ var markers = node.querySelectorAll('[data-hook="submit-form-success-message"]');
+ for (var i = 0; i < markers.length; i++) {
+ if (noteEvidence(markers[i])) return true;
+ }
+ }
return false;
}
function onMutations(muts) {
if (fired) return;
- var removed = !root.isConnected;
- if (!removed && inputsCleared()) { fire(); return; } // Wix reset the form
for (var i = 0; i < muts.length; i++) {
var added = muts[i].addedNodes || [];
for (var j = 0; j < added.length; j++) {
var node = added[j];
- if (noteEvidence(node, false)) return;
- if (node && node.nodeType === 3 && noteEvidence(muts[i].target, false)) return;
+ if (noteEvidence(node)) return;
}
- if (muts[i].type === 'attributes' && noteEvidence(muts[i].target, true)) return;
- }
- // Removal/concealment alone are too weak to fire — closing a modal or
- // an SPA page swap looks the same with no submit behind it. A
- // status/text message seen in the same attempt corroborates.
- if (statusSeen && (removed || isConcealed(root, scope))) {
- fire();
}
}
- function onPageHide() {
- // A visitor who failed Wix's validation and then left the page also
- // produces a pagehide — visible error indicators mean no submit
- // happened.
- if (hasVisibleValidationErrors(root)) return;
- fire();
- }
-
- // Scope the observer to the form's container — success messages appear
- // here and form removal shows up as a childList change on the parent.
- var scope = root.parentNode || document.body;
+ // The inline confirmation belongs to this form only.
+ var scope = root;
try {
observer = new MutationObserver(onMutations);
observer.observe(scope, {
childList: true,
- subtree: true,
- attributes: true,
- attributeFilter: ['style', 'class', 'hidden', 'aria-hidden'],
+ subtree: true
});
} catch (e) {
- // MutationObserver unavailable — rely on pagehide + timeout only
+ // Without observation, no conversion is inferred.
}
- if (pagehideTrusted) armPagehide();
-
startTimer();
}
@@ -350,35 +204,27 @@
var formId = root.getAttribute ? (root.getAttribute('data-hook') || root.id || '') : (root.id || '');
- // A form invalid under native constraint validation at click time
- // cannot have submitted, so a later pagehide must not confirm it.
- // Structural success signals stay armed regardless — they only ever
- // come from Wix itself, after an actual successful submit.
- var pagehideTrusted = true;
- try {
- if (typeof root.checkValidity === 'function' && !root.checkValidity()) {
- pagehideTrusted = false;
- }
- } catch (e) {
- // constraint validation unavailable
- }
-
var existing = findWatcher(root);
if (existing) {
- existing.refresh(formId, pagehideTrusted);
+ existing.refresh(formId);
return;
}
- watchForSuccess(root, formId, pagehideTrusted);
+ watchForSuccess(root, formId);
} catch (e) {
// Never throw back into Wix's own click handling.
}
}
if (typeof document !== 'undefined' && document.addEventListener) {
- // Bubble phase for submit: a capture-phase listener runs before Wix's own
- // handlers and would count submissions its validation goes on to cancel.
- document.addEventListener('submit', handleSubmit, false); // OLD forms
document.addEventListener('click', handleClick, true); // NEW forms
}
+
+ function discardMethod2(formId, root) {
+ try {
+ if (typeof window.__ctWixMethod2Discard === 'function') {
+ window.__ctWixMethod2Discard(formId, root);
+ }
+ } catch (e) {}
+ }
})();
diff --git a/skills/conversion-tracking/references/conversion-moments.md b/skills/conversion-tracking/references/conversion-moments.md
index 11cae82..b4ae460 100644
--- a/skills/conversion-tracking/references/conversion-moments.md
+++ b/skills/conversion-tracking/references/conversion-moments.md
@@ -194,11 +194,10 @@ python3 ../scripts/build_recipe.py --tool <slug> --send <google-ads|ga4|meta|lin
**Detection confidence.** Most of these fire on the tool's own success event or on a
confirmed success state, which is exact. `framer-forms` fires when Framer's own form
-endpoint answers its request with success. One infers success from a submit. The
-older-forms path in `wix-forms` fires on a submit that was not cancelled and passed
-constraint validation. It cannot know the server accepted the submission, so a server
-error or a spam rejection would still count. Say so if precision
-matters to the user.
+endpoint answers its request with success. `wix-forms` fires when Wix's own thank-you
+message appears inside the form, which Wix shows only after the entry is saved. It covers
+Wix's current forms with an inline thank-you message, not older Wix contact forms or forms
+set to go to another page after submitting.
## Universal patterns