## List core web vital metrics trend `client.Speed.Pages.Trend(ctx, url, params) (*Trend, error)` **get** `/zones/{zone_id}/speed_api/pages/{url}/trend` Lists the core web vital metrics trend over time for a specific page. ### Parameters - `url string` A URL. - `params PageTrendParams` - `ZoneID param.Field[string]` Path param: Identifier. - `DeviceType param.Field[PageTrendParamsDeviceType]` Query param: The type of device. - `const PageTrendParamsDeviceTypeDesktop PageTrendParamsDeviceType = "DESKTOP"` - `const PageTrendParamsDeviceTypeMobile PageTrendParamsDeviceType = "MOBILE"` - `Metrics param.Field[string]` Query param: A comma-separated list of metrics to include in the results. - `Region param.Field[PageTrendParamsRegion]` Query param: A test region. - `const PageTrendParamsRegionAsiaEast1 PageTrendParamsRegion = "asia-east1"` - `const PageTrendParamsRegionAsiaNortheast1 PageTrendParamsRegion = "asia-northeast1"` - `const PageTrendParamsRegionAsiaNortheast2 PageTrendParamsRegion = "asia-northeast2"` - `const PageTrendParamsRegionAsiaSouth1 PageTrendParamsRegion = "asia-south1"` - `const PageTrendParamsRegionAsiaSoutheast1 PageTrendParamsRegion = "asia-southeast1"` - `const PageTrendParamsRegionAustraliaSoutheast1 PageTrendParamsRegion = "australia-southeast1"` - `const PageTrendParamsRegionEuropeNorth1 PageTrendParamsRegion = "europe-north1"` - `const PageTrendParamsRegionEuropeSouthwest1 PageTrendParamsRegion = "europe-southwest1"` - `const PageTrendParamsRegionEuropeWest1 PageTrendParamsRegion = "europe-west1"` - `const PageTrendParamsRegionEuropeWest2 PageTrendParamsRegion = "europe-west2"` - `const PageTrendParamsRegionEuropeWest3 PageTrendParamsRegion = "europe-west3"` - `const PageTrendParamsRegionEuropeWest4 PageTrendParamsRegion = "europe-west4"` - `const PageTrendParamsRegionEuropeWest8 PageTrendParamsRegion = "europe-west8"` - `const PageTrendParamsRegionEuropeWest9 PageTrendParamsRegion = "europe-west9"` - `const PageTrendParamsRegionMeWest1 PageTrendParamsRegion = "me-west1"` - `const PageTrendParamsRegionSouthamericaEast1 PageTrendParamsRegion = "southamerica-east1"` - `const PageTrendParamsRegionUsCentral1 PageTrendParamsRegion = "us-central1"` - `const PageTrendParamsRegionUsEast1 PageTrendParamsRegion = "us-east1"` - `const PageTrendParamsRegionUsEast4 PageTrendParamsRegion = "us-east4"` - `const PageTrendParamsRegionUsSouth1 PageTrendParamsRegion = "us-south1"` - `const PageTrendParamsRegionUsWest1 PageTrendParamsRegion = "us-west1"` - `Start param.Field[Time]` Query param - `Tz param.Field[string]` Query param: The timezone of the start and end timestamps. - `End param.Field[Time]` Query param ### Returns - `type Trend struct{…}` - `CLS []float64` Cumulative Layout Shift trend. - `FCP []float64` First Contentful Paint trend. - `LCP []float64` Largest Contentful Paint trend. - `PerformanceScore []float64` The Lighthouse score trend. - `Si []float64` Speed Index trend. - `TBT []float64` Total Blocking Time trend. - `TTFB []float64` Time To First Byte trend. - `TTI []float64` Time To Interactive trend. ### Example ```go package main import ( "context" "fmt" "time" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/speed" ) func main() { client := cloudflare.NewClient( option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"), ) trend, err := client.Speed.Pages.Trend( context.TODO(), "example.com", speed.PageTrendParams{ ZoneID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), DeviceType: cloudflare.F(speed.PageTrendParamsDeviceTypeDesktop), Metrics: cloudflare.F("performanceScore,ttfb,fcp,si,lcp,tti,tbt,cls"), Region: cloudflare.F(speed.PageTrendParamsRegionUsCentral1), Start: cloudflare.F(time.Now()), Tz: cloudflare.F("tz"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", trend.CLS) } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "messages": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "cls": [ 0 ], "fcp": [ 0 ], "lcp": [ 0 ], "performanceScore": [ 0 ], "si": [ 0 ], "tbt": [ 0 ], "ttfb": [ 0 ], "tti": [ 0 ] } } ```