fix: 来源冲突比较升级为广告家族归一(meta/google/bing/yandex 家族)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -145,6 +145,33 @@ def test_utm_chinese_alias_baidu_matches():
|
||||
assert r["detail"].get("utm_source") == "百度"
|
||||
|
||||
|
||||
# ------------------------------------------- 广告家族归一(付费点击参数 ↔ UTM 同家族)
|
||||
def test_fbclid_with_utm_fb_same_meta_family_combined():
|
||||
r = classify(landing_path="/?fbclid=IwAR0", utm={"utm_source": "fb"})
|
||||
assert r["channel"] == "paid_search" and r["platform"] == "Meta Ads"
|
||||
assert r["resolution"] == "resolved" and r["evidence_kind"] == "combined"
|
||||
assert r["detail"].get("utm_source") == "fb" # fb ↔ Meta Ads 同 meta 家族
|
||||
|
||||
|
||||
def test_fbclid_with_utm_ig_combined():
|
||||
r = classify(landing_path="/?fbclid=IwAR0", utm={"utm_source": "ig"})
|
||||
assert r["platform"] == "Meta Ads" # ig 也在 meta 家族
|
||||
assert r["resolution"] != "conflict" and r["evidence_kind"] == "combined"
|
||||
|
||||
|
||||
def test_gclid_with_utm_google_combined():
|
||||
r = classify(landing_path="/offer?gclid=EAIaIQ", utm={"utm_source": "google"})
|
||||
assert r["channel"] == "paid_search" and r["platform"] == "Google Ads"
|
||||
assert r["resolution"] != "conflict" and r["evidence_kind"] == "combined"
|
||||
|
||||
|
||||
def test_fbclid_with_utm_tiktok_still_conflict():
|
||||
r = classify(landing_path="/?fbclid=IwAR0", utm={"utm_source": "tiktok"})
|
||||
assert r["resolution"] == "conflict" # 跨家族(meta vs tiktok)= 真矛盾
|
||||
assert r["detail"]["referrer_evidence"]["platform"] == "Meta Ads"
|
||||
assert r["detail"]["utm_evidence"]["platform"] == "tiktok"
|
||||
|
||||
|
||||
def test_utm_only_is_label_only():
|
||||
r = classify(utm={"utm_source": "newsletter"})
|
||||
assert r["channel"] == "referral" # 未知标签 → 有名 referral,但状态诚实标注
|
||||
|
||||
Reference in New Issue
Block a user