Open implementation resource · v1.0

Test citation URL normalization before trusting the totals.

Fifteen synthetic fixtures expose the edge cases that can silently inflate, merge, or erase AI-answer citation evidence. Run the reference implementation in your browser or download the same cases as JSON and CSV.

Scope: this suite tests a local comparison-key policy. It does not discover redirects, declare publisher canonicals, assess source quality, or prove that a URL supported an AI answer.

Browser test runner

The runner applies an intentionally conservative JavaScript implementation to the published fixtures. No URL is requested over the network and no input leaves this page.

Download JSON Download CSV
15synthetic fixtures
passing cases
failing cases
FixtureExpected behaviorResult
Run the suite to compare actual and expected outputs.

What the suite is designed to catch

Citation exports often contain tracking parameters, fragments, parameter-order changes, path-casing differences, and both slash variants. A permissive cleanup function can make reporting look tidy while changing the underlying evidence. These fixtures turn the policy boundary into executable checks.

Safe local transformationsLowercase the hostname, remove fragments, remove a documented analytics allowlist, and sort retained query entries.
Evidence that must surviveKeep the observed URL, path casing, unknown parameters, repeated keys, scheme, www hostname, and percent-encoded path.
Explicit invalid statesReject relative and non-HTTP(S) inputs with a named error instead of dropping rows from the analysis denominator.
Policy-dependent behaviorTest both preservation and removal of a non-root trailing slash because different servers can interpret them differently.

Recommended implementation contract

  1. Store the exact observed URL before transformation.
  2. Attach a version identifier to the normalization policy.
  3. Return either a comparison key or an explicit error state for every input row.
  4. Log each applied transformation so a reviewer can reproduce the result.
  5. Keep redirect and publisher-canonical verification in a separate dated workflow.
  6. Re-run this suite whenever the allowlist or trailing-slash rule changes.

A production implementation should add organization-specific fixtures for known CMS patterns and should review any proposed parameter removal against real destination behavior. Unknown parameters are retained by default because names such as edition, lang, page, version, and query can select different content.

How to interpret a pass

A passing result means only that the local function matches this published policy for the synthetic case. It does not establish that two pages are equivalent, that a publisher intends one canonical URL, or that the citation is accessible from every location. Redirect chains, authentication walls, challenge pages, timeouts, and regional restrictions require their own timestamped observations.

For reporting, keep counts of raw observations, unique comparison keys, and unique publisher hostnames separate. Label them precisely rather than calling all three “citations.” If a policy change alters historical totals, preserve both versions or rerun the entire frozen dataset under the new version.

Reproducibility note: every domain and input in this suite is synthetic. Reserved example.org hostnames are used to avoid implying that a real publisher appeared in an AI answer.
Read the full citation URL normalization protocol, try the browser normalizer, or explore evidence-led AI visibility workflows from Corank.