Search keywords are lost for referrers whose search engine domain starts the URL

已关闭
#8,229 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

已经有一个关联 PR 被合并了。

  • #8230 来自 @RaphaelFakhri —— 已合并

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
领域
analytics, backend

调研方向

Read plugins/sources/api/api.js and trace how urlParser checks engine names and stores search parameters; compare this with the /o/keywords check described in the issue. Reproduce with one of the listed _store referrers and confirm its stored source retains the expected keyword parameter. A pull request is already open for this issue.

由索引模型根据 Issue 内容生成。

描述

For web apps, the sources plugin stores each referrer through urlParser in plugins/sources/api/api.js. For a search engine referrer, it keeps only the search query parameter. Engine-specific parameters (wd for Baidu, p for Yahoo, text for Yandex, u for facebook.com/l.php) are kept only if the referrer path contains the engine name, checked with path.indexOf(engine) > 0.

urlParser removes the protocol and www. before this check, so for many referrers the engine name is at index 0. The check fails and the parameter is dropped. The Search keywords view (/o/keywords) then has no keyword to show for these visits. /o/keywords checks the same thing with indexOf(...) !== -1, so the two checks disagree.

Steps to reproduce

Send a session for a web app with one of these _store values:

Referrer Stored source Expected
https://www.baidu.com/s?ie=utf-8&wd=countly baidu.com/s baidu.com/s?wd=countly
https://yandex.ru/search/?lr=213&text=countly yandex.ru/search/ yandex.ru/search/?text=countly
https://yahoo.com/search?fr=yfp&p=countly yahoo.com/search yahoo.com/search?p=countly
https://www.facebook.com/l.php?u=https%3A%2F%2Fcount.ly facebook.com/l.php facebook.com/l.php?u=https%3A%2F%2Fcount.ly

Referrers where the engine is a subdomain, such as https://search.yahoo.com/search?p=countly, are not affected.

Expected behavior

The keyword is kept, and it appears under Search keywords.

主要语言
JavaScript
星标
5.9k
派生
985
平均合并
1 天 15 分钟
30 天内合并 PR
116

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。