1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* This file tests primary telemetry for dynamic Wikipedia suggestions.
*/
"use strict";
ChromeUtils.defineESModuleGetters(this, {
CONTEXTUAL_SERVICES_PING_TYPES:
"resource:///modules/PartnerLinkAttribution.sys.mjs",
});
const { TELEMETRY_SCALARS } = UrlbarProviderQuickSuggest;
const MERINO_SUGGESTION = {
block_id: 1,
url: "https://example.com/dynamic-wikipedia",
title: "Dynamic Wikipedia suggestion",
click_url: "https://example.com/click",
impression_url: "https://example.com/impression",
advertiser: "dynamic-wikipedia",
provider: "wikipedia",
iab_category: "5 - Education",
};
const suggestion_type = "dynamic-wikipedia";
const match_type = "firefox-suggest";
const index = 1;
const position = index + 1;
add_setup(async function () {
await setUpTelemetryTest({
merinoSuggestions: [MERINO_SUGGESTION],
});
});
add_task(async function () {
await doTelemetryTest({
index,
suggestion: MERINO_SUGGESTION,
// impression-only
impressionOnly: {
scalars: {
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: position,
},
event: {
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
method: "engagement",
object: "impression_only",
extra: {
suggestion_type,
match_type,
position: position.toString(),
},
},
},
selectables: {
// click
"urlbarView-row-inner": {
scalars: {
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: position,
[TELEMETRY_SCALARS.CLICK_DYNAMIC_WIKIPEDIA]: position,
"urlbar.picked.dynamic_wikipedia": index.toString(),
},
event: {
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
method: "engagement",
object: "click",
extra: {
suggestion_type,
match_type,
position: position.toString(),
},
},
},
// block
"urlbarView-button-block": {
scalars: {
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: position,
[TELEMETRY_SCALARS.BLOCK_DYNAMIC_WIKIPEDIA]: position,
},
event: {
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
method: "engagement",
object: "block",
extra: {
suggestion_type,
match_type,
position: position.toString(),
},
},
},
// help
"urlbarView-button-help": {
scalars: {
[TELEMETRY_SCALARS.IMPRESSION_DYNAMIC_WIKIPEDIA]: position,
[TELEMETRY_SCALARS.HELP_DYNAMIC_WIKIPEDIA]: position,
},
event: {
category: QuickSuggest.TELEMETRY_EVENT_CATEGORY,
method: "engagement",
object: "help",
extra: {
suggestion_type,
match_type,
position: position.toString(),
},
},
},
},
});
});
|