ads

package
v0.158.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package ads provides the Chrome DevTools Protocol commands, types, and events for the Ads domain.

A domain for ad-related metrics and data.

Generated by the pdlgen command.

Index

Constants

View Source
const (
	CommandGetAdMetrics = "Ads.getAdMetrics"
	CommandGetAdScripts = "Ads.getAdScripts"
)

Command names.

Variables

GetAdMetrics retrieves ad metrics for the current page.

See: https://chromedevtools.github.io/devtools-protocol/tot/Ads#method-getAdMetrics

GetAdScripts 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).

See: https://chromedevtools.github.io/devtools-protocol/tot/Ads#method-getAdScripts

Functions

This section is empty.

Types

type AdFrameData

type AdFrameData struct {
	FrameID       cdp.FrameID `json:"frameId"`                          // The DevTools frame token.
	InitialOrigin string      `json:"initialOrigin,omitempty,omitzero"` // The initial origin of the frame. To minimize the payload size, this is only sent once per frame.
	NetworkBytes  float64     `json:"networkBytes"`                     // The network bytes of the frame.
	CPUTime       float64     `json:"cpuTime"`                          // The CPU time of the frame, in milliseconds.
}

AdFrameData ad frame data.

See: https://chromedevtools.github.io/devtools-protocol/tot/Ads#type-AdFrameData

type AdMetrics

type AdMetrics struct {
	ViewportAdDensityByArea        int64          `json:"viewportAdDensityByArea"`        // The viewport ad density by area, represented as a percentage (an integer between 0 and 100).
	AverageViewportAdDensityByArea float64        `json:"averageViewportAdDensityByArea"` // The time-weighted average of the viewport ad density by area, measured across the duration of the page.
	ViewportAdCount                int64          `json:"viewportAdCount"`                // The number of ads currently visible within the viewport.
	AverageViewportAdCount         float64        `json:"averageViewportAdCount"`         // The time-weighted average of the viewport ad count, measured across the duration of the page.
	TotalAdCPUTime                 float64        `json:"totalAdCpuTime"`                 // The total ad CPU usage, in milliseconds.
	TotalAdNetworkBytes            float64        `json:"totalAdNetworkBytes"`            // The total ad network bytes.
	UpdateAdFrames                 []*AdFrameData `json:"updateAdFrames"`                 // The list of ad frames that have been updated since the last event.
	RemoveAdFrames                 []cdp.FrameID  `json:"removeAdFrames"`                 // The list of ad frame IDs that have been removed since the last event.
}

AdMetrics ad metrics for a page.

See: https://chromedevtools.github.io/devtools-protocol/tot/Ads#type-AdMetrics

type AdScript

type AdScript struct {
	ScriptID   cdp.ScriptID      `json:"scriptId"`   // The script ID.
	Provenance *cdp.AdProvenance `json:"provenance"` // The ad provenance.
}

AdScript 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.

See: https://chromedevtools.github.io/devtools-protocol/tot/Ads#type-AdScript

type GetAdMetricsResult added in v0.157.3

type GetAdMetricsResult struct {
	Metrics *AdMetrics `json:"metrics,omitempty,omitzero"`
}

GetAdMetricsResult is the result of the command Ads.getAdMetrics.

type GetAdScriptsResult added in v0.157.3

type GetAdScriptsResult struct {
	NewScripts []*AdScript `json:"newScripts,omitempty,omitzero"`
}

GetAdScriptsResult is the result of the command Ads.getAdScripts.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL