Skip to content

docs(traffic): document conversions from AI visits and where the Content Editor shows them (CE-017, part 5) - #1532

Merged
gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:docs/ce-017-conversions
Oct 26, 2026
Merged

gkhngyk merged 5 commits into
ansvisor:mainfrom
cihan-gyk:docs/ce-017-conversions

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

CE-017, part 5: the docs. This PR is cut from main and only touches docs. Merge it after #1527, #1528, #1529, #1530 and #1531, since it describes them.

guides/ai-traffic-analytics.mdx

  • Setup: the snippet step points to the conversions tag for brands that want conversions.
  • New section, Conversions from AI visits:
    • what it adds beside Google Analytics' key events: the pages AI visitors went through to a signup, a demo form or an order, for 30 days from their first AI visit, credited to that assistant (first touch), and where it shows (the Content Editor's Live page tab and the Content plan's AI results line);
    • off by default; a brand that doesn't turn it on keeps its tag, and the snippet keeps storing nothing;
    • four steps: turn it on in Brand settings → Tracking and choose the consent mode, replace the tag (queue line + data-c / data-consent), call ansvisor('consent', 'granted'), count conversions;
    • the tag carries the choices, so a changed Consent means copying the tag again, and turning conversions off means putting the plain tag back (until then the id is still kept in browsers, as the settings card says).
  • Consent: what counts as agreeing (the call, Google Consent Mode updates, a default before the snippet with no region, an id kept earlier), that it must come on the page the AI assistant sent the visitor to, what a regional or late default does, how consent is taken back, and Don't wait. A note says a consent template inside Google Tag Manager needs a tag that runs the consent call.
  • Forms: what counts as an email field; it counts as a signup, each form once per page load (contact and newsletter forms too, unless they name their goal); data-ansvisor-goal, data-ansvisor="off" and data-ansvisor-label; password forms count only as signups (new-password); nothing typed is sent.
  • Conversion calls: the two examples from the settings card, and a table of the fields (type, value / currency, units, order, label) with the limits the server applies (a value without a currency isn't added to revenue; an order id or label in another form is dropped).
  • Shopify: the Customer events pixel in four steps, as the settings card gives them; the consent script, needed with Wait for the visitor's consent (it also grants where Shopify needs no consent; without it no visitor is followed); headless checkouts on another domain.
  • What it can't see: refused consent or consent given after the AI landing page, AI visits without a referrer or an AI utm_source, AI Overviews and AI Mode, journeys across subdomains, forms in iframes or shadow roots, form.submit() and posts without a form, and ids Safari clears after 7 days without a visit.
  • Privacy: "The snippet sets no cookies and stores nothing" now says without conversions. With them, it names what is stored (ansvisor_v: a random id and the first AI visit), for whom, when it goes (unused after 30 days and deleted on the next page, or on withdrawn consent), and what is sent. No name, email or IP address is stored with a conversion.

guides/content-editor.mdx

  • Plan: the AI results line adds up to four goals and the Top journey line.
  • Live page tab: a paragraph under the tab list on Conversions from AI journeys: what counts as a journey through the page, the cards per site type, the conversions per AI source, the top journeys, and what it shows while conversions are off.

Related issue

Content Editor spec v2, CE-017 (§7b). Describes #1527, #1528, #1529, #1530 and #1531.

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. Open the two guides in the Mintlify preview (or read the diff).
  2. Compare the steps and button names with Brand settings → Tracking → Conversions from AI visits on the stacked branches (feat(traffic): turn conversions on in brand settings, with what to install and the Shopify pixel (CE-017, part 3) #1529), and with the Live page tab (feat(content): show conversions from AI journeys through a page on the Live page tab (CE-017, part 4a) #1530) and the Plan strip (feat(content): add the goals AI visitors reached and the top journey to the Content plan's AI results strip (CE-017, part 4b) #1531).
  3. Check that the links to #conversions-from-ai-visits, #consent, #forms, #conversion-calls and #shopify land on their headings.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/): not run, docs only
  • yarn typecheck passes (run from web/): not run, docs only
  • yarn format:check passes (run from web/): not run, docs only (Prettier doesn't cover docs/)
  • Changes are focused — one concern per PR

Docs only: no web or server code changes. I checked that the MDX components (Steps, Step, Note) and the code fences are balanced. A pre-push review checked every statement against the code of #1527–#1531.

🤖 Generated with Claude Code

cihan-gyk and others added 2 commits October 26, 2026 04:07
…orms, calls, the Shopify pixel, limits and what's stored; and where the Content Editor shows them (CE-017, part 5)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… consent script is needed, that consent must come on the AI landing page, how forms, values, order ids and labels are read, and when the stored id goes (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 443b29c.

Approve preview

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

What I checked against the code of #1527–#1531:

  • Setup.

    • The names match the settings card: Track conversions from AI visits, the two Consent choices and their hints, Use this tag, Shopify store and Show the Shopify pixel. The pixel shows at once for an e-commerce site.
    • Only admins and managers can change them (canManage).
    • The two-line tag is trackingSnippetTag's, with the queue stub first.
    • Turning conversions off works as described: the server drops the events (storeEvent checks conversions_enabled), while the old tag still keeps the id. The card's "off" toast says the same.
  • Consent. It matches the snippet's checks, in order:

    • an update that denies deletes the id;
    • an update that grants turns following on;
    • a default that denies pauses it;
    • a regional default waits, and an id kept earlier goes on;
    • otherwise, a granting default, an earlier id or Don't wait turns it on.

    Two more points match: a default set after the snippet only pauses it, and events wait in the page's memory. The Google Tag Manager note matches the card.

  • Forms. These match too:

    • the email field selectors;
    • once per form per page load;
    • a goal attribute skips the email check, and an unknown goal becomes custom;
    • data-ansvisor="off", and the label from data-ansvisor-label, id or name;
    • the password rule;
    • nothing typed is sent.
  • Conversion calls. Each limit matches the snippet and traffic-events.js:

    • value from 0 to 1e9;
    • a three-letter currency, kept only with a value;
    • whole units up to 100,000;
    • the order id's characters, counted once per visitor (00286's unique index);
    • the label's characters, with long digit runs dropped.

    Revenue counts orders and bookings with a currency (00287).

  • Shopify.

    • The four steps match the card's text.
    • The consent script shows only with Wait, goes after the tag (so the queue stub exists), and grants where analyticsProcessingAllowed() does.
    • The note on headless stores matches.
  • What it can't see and Privacy.

    • They match the snippet: storage is per origin, forms are caught by a submit listener, and ansvisor_v holds the id and the first visit's source, page and time.
    • The id is deleted after 30 days on the next page with the tag, or when consent is taken back.
    • Pages are sent without their query string, and events store no IP.
  • Content Editor.

    • The strip (four goals, "orders from journeys", Top journey) matches #1531.
    • The Live page section (what counts, cards per site type, sources, conversions off) matches #1530.
  • Links. The new anchors land on their headings, and no heading in the guide repeats.

Low, wording (fine as a follow-up):

  1. docs/guides/ai-traffic-analytics.mdx:285 says the pixel sends the order id. When Shopify's event has no order id, the pixel sends the checkout's token in its place (web/src/lib/conversion-tracking.ts:111, #1529). The pixel already keeps that token out of the address it sends. Dropping the fallback in #1529 would make this line right as it stands. If the fallback stays, say so here.
  2. docs/guides/content-editor.mdx:70: the Top journey is picked among the period's latest 2,000 conversions (00288), so for a big brand its count covers those only. Add "among the latest 2,000 conversions" after "how many conversions took that way".

…M tag for it, what a refusal keeps on the page, the order id kept as a hash and never the checkout token, the email kept out of a path, the per-visitor limits, and the journeys' bounds (review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Thanks, both are fixed (4b9f1b0). The guide also follows the review fixes in #1527–#1531:

  • Pixel: it sends Shopify's order id only when the event has one, never the checkout token (feat(traffic): turn conversions on in brand settings, with what to install and the Shopify pixel (CE-017, part 3) #1529).
  • Content Editor: the top journey is picked "among the period's latest 2,000 conversions". The Live page paragraph says a long journey keeps this page in view, and that journeys show their latest 100 pages while the counts take every conversion.
  • Consent:
    • the refusal call is shown for both modes, and Tag Manager needs a tag for each;
    • a refusal keeps the journey on the page if the visitor then agrees;
    • queued consent calls run first.
  • Data limits: the order id is kept only as a hash; a path segment with an email is stored as [email]; and the per-visitor limits (300 pages in 30 days, 10 conversions a day) are listed under "What it can't see".

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs changes.

What I checked:

  • Earlier items.
    1. Done. ai-traffic-analytics.mdx:285 says the pixel sends Shopify's order id only when the event has one, never the checkout's token. That's what the pixel now does (conversion-tracking.ts:119, #1529).
    2. Done. content-editor.mdx:70 says the top journey is picked among the period's latest 2,000 conversions (00288).
  • The new text, against the current heads of #1527–#1531.
    • Refusal. The denied call matches the card for both modes, including Don't wait. So does what it does: the stored id is deleted, the events waiting on the page are dropped, and nothing more is sent from that page. The reason given is right: the snippet takes an id kept earlier as consent given. The Tag Manager note asks for both tags, as the card does.
    • Consent.
      • After a refusal, the page keeps the id in memory, so a grant later on the same page still keeps the journey.
      • Queued consent calls run before the others.
      • Both match the snippet.
    • Order ids are kept only as a hash of the brand and the id (orderKey), and count once per visitor.
    • Paths. A path segment that holds an email, raw or %40-encoded, is stored as [email]. A handle such as /@acme stays (eventUrl).
    • Limits. A visitor id stores at most 300 pageviews in 30 days and 10 conversions a day, checked before each insert (traffic.js:249-259).
    • Live page (content-editor.mdx:127) matches 00287 and the tab:
      • a long journey keeps this page in view;
      • journeys come from the latest 2,000 conversions, each with its latest 100 pageviews;
      • the counts take every conversion.
  • Merge. Docs only. It merges cleanly on current main.
  • Before the API deploy. The guide goes live with the merge, beside the card it describes. Until the API is deployed, following it stores nothing, and nothing breaks.

Fix before merge:

  1. docs/guides/ai-traffic-analytics.mdx:211: Don't wait still reads "use this only if your cookie banner or privacy policy already covers analytics storage".
    • #1529 changed the card's hint to "Use this only if your cookie banner already asks for analytics storage, or where no consent is needed" (web/messages/en.json:7961), because a privacy policy isn't consent.
    • As written, the guide tells a site it can skip the visitor's consent on the strength of its privacy policy.
    • Use the card's words.

Low, follow-up:
2. ai-traffic-analytics.mdx:230: with Don't wait, a visitor who refused once gets a new id at once on their next visit from an AI assistant. Only a denied call on that page stops it. Queued calls run first, so a queued denied keeps nothing.

  • Google Consent Mode sites are covered already: a denying default pauses the snippet.
  • Any other banner has to repeat the refusal on each page, as the grant is repeated ("on every page after").
  • Add "and, with Don't wait, on every page while the visitor's answer is no".
  • The card's steps.denyHelp (#1529, en.json:7969) needs the same words.

cihan-gyk and others added 2 commits October 26, 2026 14:48
…for analytics storage, or where no consent is needed, and that with Don't wait the refusal is called on every page while the answer is no (review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… and with Don't wait on every page after, while they say no (pre-push review)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cihan-gyk

Copy link
Copy Markdown
Collaborator Author

Done (443b29c).

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

What I checked:

  • Earlier items.
    1. Done (e338398). For Don't wait, docs/guides/ai-traffic-analytics.mdx:211 now uses the card's words (alwaysHint, web/messages/en.json:8000 in #1529): "use this only if your cookie banner already asks for analytics storage, or where no consent is needed". The privacy policy is gone.
    2. Done (e338398, 443b29c). :230 says to make the refusal call in both modes, and with Don't wait on every page after, while they say no. It also gives the reason: otherwise a visitor who comes back from an AI assistant is given a new id at once.
      • That's what #1528's snippet does. With Don't wait, a new id is kept at load (tracking-script.js:152, :173), unless a queued refusal or Consent Mode says no.
      • What the call does matches deny() (:143).
      • The card asks for the call on every page in both modes, and the guide asks for it with Don't wait. Under Wait the extra calls do nothing, so the two agree.
  • The rest of the guide hasn't changed since round 31. The line on paths (:320, "a part of the path that holds an email is stored as [email]") still holds with #1527's holdsEmail, which also catches an encoded dot.
  • Merge. Docs only. The PR is based on an older main, but it still merges cleanly on today's main (a443462) and on #1531's head (618ba46).
  • Before the API deploy. As before: following the guide stores nothing until the API is deployed, and nothing breaks.

@gkhngyk
gkhngyk merged commit 5bf373f into ansvisor:main Oct 26, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants