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
115
116
117
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.
//! A domain for ad-related metrics and data.
//!
//! Types, command parameters and event payloads for the `Ads`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].
//!
//! This domain is experimental and may change without notice.
use serde::{Deserialize, Serialize};
/// Ad frame data.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AdFrameData {
/// The DevTools frame token.
#[serde(rename = "frameId")]
pub frame_id: crate::protocol::page::FrameId,
/// The initial origin of the frame. To minimize the payload size, this is
/// only sent once per frame.
#[serde(
rename = "initialOrigin",
default,
skip_serializing_if = "Option::is_none"
)]
pub initial_origin: Option<String>,
/// The network bytes of the frame.
#[serde(rename = "networkBytes")]
pub network_bytes: f64,
/// The CPU time of the frame, in milliseconds.
#[serde(rename = "cpuTime")]
pub cpu_time: f64,
}
/// Ad metrics for a page.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AdMetrics {
/// The viewport ad density by area, represented as a percentage (an integer
/// between 0 and 100).
#[serde(rename = "viewportAdDensityByArea")]
pub viewport_ad_density_by_area: i64,
/// The time-weighted average of the viewport ad density by area, measured
/// across the duration of the page.
#[serde(rename = "averageViewportAdDensityByArea")]
pub average_viewport_ad_density_by_area: f64,
/// The number of ads currently visible within the viewport.
#[serde(rename = "viewportAdCount")]
pub viewport_ad_count: i64,
/// The time-weighted average of the viewport ad count, measured across the
/// duration of the page.
#[serde(rename = "averageViewportAdCount")]
pub average_viewport_ad_count: f64,
/// The total ad CPU usage, in milliseconds.
#[serde(rename = "totalAdCpuTime")]
pub total_ad_cpu_time: f64,
/// The total ad network bytes.
#[serde(rename = "totalAdNetworkBytes")]
pub total_ad_network_bytes: f64,
/// The list of ad frames that have been updated since the last event.
#[serde(rename = "updateAdFrames")]
pub update_ad_frames: Vec<AdFrameData>,
/// The list of ad frame IDs that have been removed since the last event.
#[serde(rename = "removeAdFrames")]
pub remove_ad_frames: Vec<crate::protocol::page::FrameId>,
}
/// An ad script. Note: when the script is a transitive ad script, we only
/// fill in the immediate ancestor script in the provenance's adScriptAncestry
/// field (as its first entry), rather than filling in the full ancestry. This
/// saves work for the backend, and the frontend can reconstruct the full
/// ancestry if necessary.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AdScript {
/// The script ID.
#[serde(rename = "scriptId")]
pub script_id: crate::protocol::runtime::ScriptId,
/// The ad provenance.
pub provenance: crate::protocol::network::AdProvenance,
}
/// Retrieves ad metrics for the current page.
///
/// Parameters of `Ads.getAdMetrics`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetAdMetricsParams {}
/// What `Ads.getAdMetrics` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetAdMetricsReturns {
pub metrics: AdMetrics,
}
impl crate::typed::Command for GetAdMetricsParams {
const METHOD: &'static str = "Ads.getAdMetrics";
type Returns = GetAdMetricsReturns;
}
/// Retrieves ad scripts for the current page. To minimize payload size, this
/// only returns the newly tracked ad scripts since the last call to
/// getAdScripts (i.e., the delta).
///
/// Parameters of `Ads.getAdScripts`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetAdScriptsParams {}
/// What `Ads.getAdScripts` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetAdScriptsReturns {
#[serde(rename = "newScripts")]
pub new_scripts: Vec<AdScript>,
}
impl crate::typed::Command for GetAdScriptsParams {
const METHOD: &'static str = "Ads.getAdScripts";
type Returns = GetAdScriptsReturns;
}