Skip to content

Add Organic AI referrer attribution#46182

Merged
johnjeremiah merged 2 commits into
mainfrom
jj-add-llm-attribution
May 29, 2026
Merged

Add Organic AI referrer attribution#46182
johnjeremiah merged 2 commits into
mainfrom
jj-add-llm-attribution

Conversation

@johnjeremiah
Copy link
Copy Markdown
Contributor

@johnjeremiah johnjeremiah commented May 26, 2026

Detect AI/LLM referrers and classify them as an "Organic AI (AI)" source. Adds a REFERRER_DOMAINS_FOR_ORGANIC_AI list and branching logic to set attributionDetails.sourceChannelDetails and attributionDetails.campaign based on the referring AI platform (ChatGPT, Claude, Gemini, or Other) in website/api/helpers/salesforce/update-or-create-contact-and-account.js.

Related issue:
resolves fleetdm/confidential#16034

Summary by CodeRabbit

  • New Features
    • Improved contact attribution: traffic from AI/LLM platforms (ChatGPT, Claude, Gemini, etc.) is now labeled "Organic AI (AI)" and assigned platform-specific default campaigns.
    • Refined organic search detection to better identify Bing search referrals.
    • Other non-digital/non-event referrers now default to "Web referral (WR)".

Review Change Stack

Detect AI/LLM referrers and classify them as an "Organic AI (AI)" source. Adds a REFERRER_DOMAINS_FOR_ORGANIC_AI list and branching logic to set attributionDetails.sourceChannelDetails and attributionDetails.campaign based on the referring AI platform (ChatGPT, Claude, Gemini, or Other) in website/api/helpers/salesforce/update-or-create-contact-and-account.js.
@fleet-release fleet-release requested a review from eashaw May 26, 2026 12:09
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 92ac8830-ebc0-4c0f-bb32-292e362b2d96

📥 Commits

Reviewing files that changed from the base of the PR and between 97fa873 and de994dc.

📒 Files selected for processing (1)
  • website/api/helpers/salesforce/update-or-create-contact-and-account.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • website/api/helpers/salesforce/update-or-create-contact-and-account.js

Walkthrough

This PR tightens Bing organic search detection to match https://www.bing.com/search (line 289), adds a REFERRER_DOMAINS_FOR_ORGANIC_AI allowlist of AI/LLM referrer base URLs (lines 327–358), and inserts classification logic (lines 371–383) that labels matching referrers as "Organic AI (AI)" and assigns platform-specific default campaigns (ChatGPT, Claude, Gemini, or Default-AI-Other).

Possibly related PRs

  • fleetdm/fleet#45803: Modifies the same attribution logic in update-or-create-contact-and-account.js to tune referrer matching and Organic classification patterns.
  • fleetdm/fleet#45807: Updates referrer-to-attribution mapping in the same Salesforce helper, overlapping with Organic/Bing matching changes.
  • fleetdm/fleet#46096: Changes referrer/attribution handling in the same helper; related to how referrer data is derived and persisted for Salesforce attribution fields.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description clearly explains the feature added and references the related confidential issue, but the required PR description template checklist is not included or completed. Add the repository's PR description template with completed checklist items to document testing, validation, and review considerations for the changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding detection and attribution of AI/LLM referrers, which aligns with the primary purpose of the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jj-add-llm-attribution

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@website/api/helpers/salesforce/update-or-create-contact-and-account.js`:
- Around line 327-357: REFERRER_DOMAINS_FOR_ORGANIC_SEARCH is currently too
broad (e.g., 'https://www.bing.com/') so referrers for Bing Chat/Copilot (listed
in REFERRER_DOMAINS_FOR_ORGANIC_AI) are matched by referrer.startsWith(domain)
as Organic Search; update the search list to use more specific Bing search
prefixes such as 'https://www.bing.com/search' (and equivalent
'https://bing.com/search' variants) instead of the root host, or otherwise
narrow the matching pattern, so that referrers like 'https://www.bing.com/chat'
match REFERRER_DOMAINS_FOR_ORGANIC_AI; keep the existing
referrer.startsWith(domain) logic and the arrays
REFERRER_DOMAINS_FOR_ORGANIC_SEARCH and REFERRER_DOMAINS_FOR_ORGANIC_AI as the
locations to change.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 6a41002c-26a3-41c5-ab3f-5f5fe1fb82ba

📥 Commits

Reviewing files that changed from the base of the PR and between 9858a5b and 97fa873.

📒 Files selected for processing (1)
  • website/api/helpers/salesforce/update-or-create-contact-and-account.js

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

eashaw
eashaw previously approved these changes May 29, 2026
@eashaw eashaw dismissed their stale review May 29, 2026 15:15

Accidentally submitted this review, will submit a new review momentarily

@johnjeremiah johnjeremiah merged commit 45a7ad2 into main May 29, 2026
12 checks passed
@johnjeremiah johnjeremiah deleted the jj-add-llm-attribution branch May 29, 2026 22:39
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