check_fbc_code
Statically checks HTML or JavaScript that writes Meta's _fbc and _fbp cookies from fbclid, catching click-ID modifications, truncation, stale IDs, and millisecond timestamp errors before deployment.
Instructions
Statically check HTML or JavaScript that reads fbclid from the URL and writes Meta's _fbc click ID cookie (and optionally _fbp). It catches the mistakes that make Meta Events Manager report a modified fbclid or attribute a conversion to the wrong ad: keeping an old click ID when a visitor arrives from a new ad, decoding, re-casing or truncating the click ID, writing creationTime in seconds instead of milliseconds, and hard-coding subdomainIndex. Rules: FBC-01: A new fbclid must overwrite an older _fbc cookie. FBC-02: Do not URL-decode fbclid a second time. FBC-03: Do not change the case of fbclid. FBC-04: Do not truncate fbclid. FBC-05: _fbc creationTime must be in milliseconds. FBC-06: Check that a hard-coded subdomainIndex matches the cookie domain. FBP-01: _fbp creationTime must be in milliseconds. Returns JSON with status ("pass", "fail", "unknown" or "not_applicable"), failed, unknown and warnings (rule IDs), and rules (one entry per rule with status "pass", "fail", "unknown" or "warn", evidence, what it protects against, severity, and a link to Meta's documentation). "unknown" means no rule failed but at least one could not decide, for example FBC-01 when it cannot tell which variable holds the fbclid from the URL. "not_applicable" means no _fbc appeared in the content, so nothing was judged. Neither is a pass. "warn" comes from a warning-level rule (FBC-06) and never changes the overall status. This is static analysis of source text, not execution: minified, bundled or obfuscated code can hide a mistake, so a pass is not proof of correctness.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | HTML or JavaScript source to check. Include every file that touches fbclid, _fbc or _fbp, concatenated. | |
| kind | No | How to read `code`. "html": analyse the inline <script> bodies. "js": analyse it as JavaScript. "auto": HTML if it starts with "<", JavaScript otherwise. | auto |