зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1511065 - Update existing search telemetry provider field names to match those of the new remote settings schema. r=daleharvey
Differential Revision: https://phabricator.services.mozilla.com/D92244
This commit is contained in:
Родитель
4acf1656a8
Коммит
95cf7925c0
|
@ -100,7 +100,7 @@ class SearchTelemetryChild extends JSWindowActorChild {
|
||||||
*/
|
*/
|
||||||
_getProviderInfoForUrl(url) {
|
_getProviderInfoForUrl(url) {
|
||||||
return Object.entries(searchProviders.info || []).find(([_, info]) =>
|
return Object.entries(searchProviders.info || []).find(([_, info]) =>
|
||||||
info.regexp.test(url)
|
info.searchPageRegexp.test(url)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,19 +63,19 @@ const SEARCH_TELEMETRY_PRIVATE_BROWSING_KEY_SUFFIX = "pb";
|
||||||
*/
|
*/
|
||||||
const SEARCH_PROVIDER_INFO = {
|
const SEARCH_PROVIDER_INFO = {
|
||||||
google: {
|
google: {
|
||||||
regexp: /^https:\/\/www\.google\.(?:.+)\/search/,
|
searchPageRegexp: /^https:\/\/www\.google\.(?:.+)\/search/,
|
||||||
queryParam: "q",
|
queryParamName: "q",
|
||||||
codeParam: "client",
|
codeParamName: "client",
|
||||||
codePrefixes: ["firefox"],
|
codePrefixes: ["firefox"],
|
||||||
followonParams: ["oq", "ved", "ei"],
|
followOnParamNames: ["oq", "ved", "ei"],
|
||||||
extraAdServersRegexps: [
|
extraAdServersRegexps: [
|
||||||
/^https:\/\/www\.google(?:adservices)?\.com\/(?:pagead\/)?aclk/,
|
/^https:\/\/www\.google(?:adservices)?\.com\/(?:pagead\/)?aclk/,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
duckduckgo: {
|
duckduckgo: {
|
||||||
regexp: /^https:\/\/duckduckgo\.com\//,
|
searchPageRegexp: /^https:\/\/duckduckgo\.com\//,
|
||||||
queryParam: "q",
|
queryParamName: "q",
|
||||||
codeParam: "t",
|
codeParamName: "t",
|
||||||
codePrefixes: ["ff", "newext"],
|
codePrefixes: ["ff", "newext"],
|
||||||
extraAdServersRegexps: [
|
extraAdServersRegexps: [
|
||||||
/^https:\/\/duckduckgo.com\/y\.js?.*ad_provider\=/,
|
/^https:\/\/duckduckgo.com\/y\.js?.*ad_provider\=/,
|
||||||
|
@ -83,28 +83,28 @@ const SEARCH_PROVIDER_INFO = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
yahoo: {
|
yahoo: {
|
||||||
regexp: /^https:\/\/(?:.*)search\.yahoo\.com\/search/,
|
searchPageRegexp: /^https:\/\/(?:.*)search\.yahoo\.com\/search/,
|
||||||
queryParam: "p",
|
queryParamName: "p",
|
||||||
},
|
},
|
||||||
baidu: {
|
baidu: {
|
||||||
regexp: /^https:\/\/www\.baidu\.com\/(?:s|baidu)/,
|
searchPageRegexp: /^https:\/\/www\.baidu\.com\/(?:s|baidu)/,
|
||||||
queryParam: "wd",
|
queryParamName: "wd",
|
||||||
codeParam: "tn",
|
codeParamName: "tn",
|
||||||
codePrefixes: ["34046034_", "monline_"],
|
codePrefixes: ["34046034_", "monline_"],
|
||||||
followonParams: ["oq"],
|
followOnParamNames: ["oq"],
|
||||||
},
|
},
|
||||||
bing: {
|
bing: {
|
||||||
regexp: /^https:\/\/www\.bing\.com\/search/,
|
searchPageRegexp: /^https:\/\/www\.bing\.com\/search/,
|
||||||
queryParam: "q",
|
queryParamName: "q",
|
||||||
codeParam: "pc",
|
codeParamName: "pc",
|
||||||
codePrefixes: ["MOZ", "MZ"],
|
codePrefixes: ["MOZ", "MZ"],
|
||||||
followonCookies: [
|
followOnCookies: [
|
||||||
{
|
{
|
||||||
extraCodeParam: "form",
|
extraCodeParamName: "form",
|
||||||
extraCodePrefixes: ["QBRE"],
|
extraCodePrefixes: ["QBRE"],
|
||||||
host: "www.bing.com",
|
host: "www.bing.com",
|
||||||
name: "SRCHS",
|
name: "SRCHS",
|
||||||
codeParam: "PC",
|
codeParamName: "PC",
|
||||||
codePrefixes: ["MOZ", "MZ"],
|
codePrefixes: ["MOZ", "MZ"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -454,7 +454,7 @@ class TelemetryHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.entries(this._searchProviderInfo).find(([_, info]) =>
|
return Object.entries(this._searchProviderInfo).find(([_, info]) =>
|
||||||
info.regexp.test(url)
|
info.searchPageRegexp.test(url)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,35 +473,35 @@ class TelemetryHandler {
|
||||||
}
|
}
|
||||||
let [provider, searchProviderInfo] = info;
|
let [provider, searchProviderInfo] = info;
|
||||||
let queries = new URLSearchParams(url.split("#")[0].split("?")[1]);
|
let queries = new URLSearchParams(url.split("#")[0].split("?")[1]);
|
||||||
if (!queries.get(searchProviderInfo.queryParam)) {
|
if (!queries.get(searchProviderInfo.queryParamName)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// Default to organic to simplify things.
|
// Default to organic to simplify things.
|
||||||
// We override type in the sap cases.
|
// We override type in the sap cases.
|
||||||
let type = "organic";
|
let type = "organic";
|
||||||
let code;
|
let code;
|
||||||
if (searchProviderInfo.codeParam) {
|
if (searchProviderInfo.codeParamName) {
|
||||||
code = queries.get(searchProviderInfo.codeParam);
|
code = queries.get(searchProviderInfo.codeParamName);
|
||||||
if (
|
if (
|
||||||
code &&
|
code &&
|
||||||
searchProviderInfo.codePrefixes.some(p => code.startsWith(p))
|
searchProviderInfo.codePrefixes.some(p => code.startsWith(p))
|
||||||
) {
|
) {
|
||||||
if (
|
if (
|
||||||
searchProviderInfo.followonParams &&
|
searchProviderInfo.followOnParamNames &&
|
||||||
searchProviderInfo.followonParams.some(p => queries.has(p))
|
searchProviderInfo.followOnParamNames.some(p => queries.has(p))
|
||||||
) {
|
) {
|
||||||
type = "sap-follow-on";
|
type = "sap-follow-on";
|
||||||
} else {
|
} else {
|
||||||
type = "sap";
|
type = "sap";
|
||||||
}
|
}
|
||||||
} else if (searchProviderInfo.followonCookies) {
|
} else if (searchProviderInfo.followOnCookies) {
|
||||||
// Especially Bing requires lots of extra work related to cookies.
|
// Especially Bing requires lots of extra work related to cookies.
|
||||||
for (let followonCookie of searchProviderInfo.followonCookies) {
|
for (let followOnCookie of searchProviderInfo.followOnCookies) {
|
||||||
if (followonCookie.extraCodeParam) {
|
if (followOnCookie.extraCodeParamName) {
|
||||||
let eCode = queries.get(followonCookie.extraCodeParam);
|
let eCode = queries.get(followOnCookie.extraCodeParamName);
|
||||||
if (
|
if (
|
||||||
!eCode ||
|
!eCode ||
|
||||||
!followonCookie.extraCodePrefixes.some(p => eCode.startsWith(p))
|
!followOnCookie.extraCodePrefixes.some(p => eCode.startsWith(p))
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -511,10 +511,10 @@ class TelemetryHandler {
|
||||||
// This might be an organic follow-on in the same session, but there
|
// This might be an organic follow-on in the same session, but there
|
||||||
// is no way to tell the difference.
|
// is no way to tell the difference.
|
||||||
for (let cookie of Services.cookies.getCookiesFromHost(
|
for (let cookie of Services.cookies.getCookiesFromHost(
|
||||||
followonCookie.host,
|
followOnCookie.host,
|
||||||
{}
|
{}
|
||||||
)) {
|
)) {
|
||||||
if (cookie.name != followonCookie.name) {
|
if (cookie.name != followOnCookie.name) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,8 +522,8 @@ class TelemetryHandler {
|
||||||
.split("=")
|
.split("=")
|
||||||
.map(p => p.trim());
|
.map(p => p.trim());
|
||||||
if (
|
if (
|
||||||
cookieParam == followonCookie.codeParam &&
|
cookieParam == followOnCookie.codeParamName &&
|
||||||
followonCookie.codePrefixes.some(p => cookieValue.startsWith(p))
|
followOnCookie.codePrefixes.some(p => cookieValue.startsWith(p))
|
||||||
) {
|
) {
|
||||||
type = "sap-follow-on";
|
type = "sap-follow-on";
|
||||||
code = cookieValue;
|
code = cookieValue;
|
||||||
|
|
|
@ -16,11 +16,11 @@ const { ADLINK_CHECK_TIMEOUT_MS } = ChromeUtils.import(
|
||||||
|
|
||||||
const TEST_PROVIDER_INFO = {
|
const TEST_PROVIDER_INFO = {
|
||||||
example: {
|
example: {
|
||||||
regexp: /^http:\/\/mochi.test:.+\/browser\/browser\/components\/search\/test\/browser\/searchTelemetry(?:Ad)?.html/,
|
searchPageRegexp: /^http:\/\/mochi.test:.+\/browser\/browser\/components\/search\/test\/browser\/searchTelemetry(?:Ad)?.html/,
|
||||||
queryParam: "s",
|
queryParamName: "s",
|
||||||
codeParam: "abc",
|
codeParamName: "abc",
|
||||||
codePrefixes: ["ff"],
|
codePrefixes: ["ff"],
|
||||||
followonParams: ["a"],
|
followOnParamNames: ["a"],
|
||||||
extraAdServersRegexps: [/^https:\/\/example\.com\/ad2?/],
|
extraAdServersRegexps: [/^https:\/\/example\.com\/ad2?/],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче