Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/lib/ab-testing/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@ import { SITE_URL } from "@/lib/constants"

import type { ABTestAssignment, ABTestConfig } from "./types"

// Search engine and social media crawlers - serve Original to ensure consistent
// indexing and link previews. This is NOT cloaking per Google's A/B testing guidelines:
// https://developers.google.com/search/docs/advanced/guidelines/cloaking
const BOT_PATTERN =
/googlebot|bingbot|yandex|baiduspider|duckduckbot|slurp|facebookexternalhit|twitterbot|linkedinbot|discordbot|telegrambot|whatsapp|slackbot/i

const getABTestConfigs = async (): Promise<Record<string, ABTestConfig>> => {
try {
const response = await fetch(`${SITE_URL}/api/ab-config`, {
Expand Down Expand Up @@ -38,10 +32,6 @@ export const getABTestAssignment = async (
headers.get("x-forwarded-for") || headers.get("x-real-ip") || "unknown"
const userAgent = headers.get("user-agent") || ""

// Always serve Original to bots to prevent indexing fluctuation during A/B tests
// and ensure consistent social media link previews
if (BOT_PATTERN.test(userAgent)) return null

// Add privacy-preserving entropy sources
const acceptLanguage = headers.get("accept-language") || ""
const acceptEncoding = headers.get("accept-encoding") || ""
Expand Down