Site icon DataForSEO

How to get Core Web Vitals with On-Page API?

At DataForSEO, we test pages for Core Web Vitals in our own system with a simulated page load in a controlled set of conditions. In other words, we provide performance metrics based on lab data. Using lab data is generally considered the best option for rectifying website issues harmful to user experience and seeing immediate results.

To obtain the vital page experience metrics with DataForSEO On-Page API, you should register and get your API key necessary for authentication.

Learn more about Authentication in our docs >>

Once you have the API key, you can set a task using On-Page API Task POST.

Besides specifying the target, set a limit for the number of pages to crawl. To receive Core Web Vitals, you should also set the following parameters to true: load_resources, enable_javascript, enable_browser_rendering.

Your POST request body should be structured as in the example below:

[
  {
    "target": "theguardian.com",
    "max_crawl_pages": 10,
    "load_resources": true,
    "enable_javascript": true,
    "enable_browser_rendering": true
  }
]

Essentially, the last three parameters will instruct our crawler to:

Note that the use of parameters given above increases the cost of the task. To learn more, please refer to this help article.

Once you’ve set a task to On-Page API, you can obtain Core Web Vitals in the responses of several endpoints:

All these endpoints indicate detailed performance metrics for each listed page, including meta tags checks, page timing, and over 60 other on-page check-ups.

Core Web Vitals will be provided in separate fields of two arrays. In particular, you will find Cumulative Layout Shift in the meta array:

{
  "meta": {
    "cumulative_layout_shift": 0.10156329069412295
  }
}

First Input Delay and Largest Contentful Paint will be returned in the page_timing array:

{
  "page_timing": {
    "largest_contentful_paint": 1648.4750006347895,
    "first_input_delay": 0.0550001859664917
  }
}

Below you can review a full response sample from the Pages endpoint of On-Page API with all vital metrics and more. Note that you can additionally apply filters (free of charge) to extract a list of pages matching specific rules. For example, to get only pages with a CLS score greater than 0.25, you should specify the following rule in the “filters” array: [“meta.cumulative_layout_shift”,”>=”,”0.25″].

{
    "version": "0.1.20210907",
    "status_code": 20000,
    "status_message": "Ok.",
    "time": "1.6464 sec.",
    "cost": 0,
    "tasks_count": 1,
    "tasks_error": 0,
    "tasks": [
        {
            "id": "09141515-1535-0216-0000-9de8130161cb",
            "status_code": 20000,
            "status_message": "Ok.",
            "time": "1.5925 sec.",
            "cost": 0,
            "result_count": 1,
            "path": [
                "v3",
                "on_page",
                "pages"
            ],
            "data": {
                "api": "on_page",
                "function": "pages",
                "limit": 1,
                "target": "theguardian.com",
                "max_crawl_pages": 10,
                "load_resources": true,
                "enable_javascript": true,
                "enable_browser_rendering": true
            },
            "result": [
                {
                    "crawl_progress": "finished",
                    "crawl_status": {
                        "max_crawl_pages": 10,
                        "pages_in_queue": 0,
                        "pages_crawled": 10
                    },
                    "total_items_count": 10,
                    "items_count": 1,
                    "items": [
                        {
                            "resource_type": "html",
                            "status_code": 200,
                            "location": null,
                            "url": "https://www.theguardian.com/international",
                            "meta": {
                                "title": "News, sport and opinion from the Guardian's global edition | The Guardian",
                                "charset": 65001,
                                "follow": true,
                                "generator": null,
                                "htags": {
                                    "h1": [
                                        "News, sport and opinion from the Guardian's global edition"
                                    ],
                                    "h2": [
                                        "Palette styles new do not delete",
                                        "Headlines",
                                        "Spotlight",
                                        "Coronavirus",
                                        "Sport",
                                        "Opinion",
                                        "Today in Focus",
                                        "Podcast\n             \n             \n             Is Brexit the reason McDonald’s is running out of milkshakes?",
                                        "Listen to previous episodes",
                                        "This is Europe",
                                        "Climate crisis",
                                        "Around the world",
                                        "Contact the Guardian",
                                        "Culture",
                                        "Lifestyle",
                                        "Explore",
                                        "Take part",
                                        "Videos",
                                        "In pictures"
                                    ],
                                    "h3": [
                                        "Afghanistan  Questions in Kabul as two top Taliban leaders ‘missing from public view’",
                                        "China  Property giant Evergrande admits debt crisis as protesters besiege HQ",
                                        "‘It’s a reality’  Biden calls for urgency in California as climate crisis fuels wildfires",
                                        "Wildlife  Butterflies released in Finland contained parasitic wasps – with more wasps inside",
                                        "Russia  Putin self-isolates after coronavirus found in entourage",
                                        "Pollution  Most plans for new coal plants scrapped since Paris agreement",
                                        "European Union  Britain to delay some post-Brexit border controls due to Covid crisis",
                                        "‘Time to take sides’  Post-Merkel era needs radical new direction, says study",
                                        "Lake Tahoe  Ski resort changes name to remove racist and misogynistic slur",
                                        "Tucker Carlson  Fox News host tells interviewer: ‘I lie’",
                                        "The Met Gala 2021  Eight key moments from fashion’s big night",
                                        "Sexual healing  I’m worried my husband’s porn use has ruined his sex drive",
                                        "‘It brought people back together’  The summer after 9/11",
                                        "The long read  When Wall Street came to coal country: how a big-money gamble scarred Appalachia",
                                        "‘These are the facts’  Black educators silenced from teaching America’s racist past",
                                        "Hurry up and wait  The joys of slow culture",
                                        "‘Virus is painfully real’  Loved ones of vaccine-hesitant victims urge the world to listen",
                                        "‘Virus is painfully real’  Loved ones of vaccine-hesitant victims urge the world to listen",
                                        "Live  Coronavirus: Vladimir Putin self-isolating; new China outbreak grows",
                                        "Live  Coronavirus: Vladimir Putin self-isolating; new China outbreak grows",
                                        "UK  Covid booster jab to be offered to those at most risk and over-50s in UK",
                                        "UK  Covid booster jab to be offered to those at most risk and over-50s in UK",
                                        "Vaccine mandate  LA officers sue as police across California threaten to resign",
                                        "Vaccine mandate  LA officers sue as police across California threaten to resign",
                                        "Raducanu and Medvedev signal new era and shift major expectations",
                                        "The Kaepernick Effect  A story of the other athletes who kneeled in protest",
                                        "The Breakdown  Absent Lions give England’s young hopefuls their Premiership chance",
                                        "Fethi Nourine  Algerian judoka gets 10-year ban for refusing to face Israeli at Olympics",
                                        "Young Boys’ David Wagner   \n                   \n                    \n                    I loved every second in English football",
                                        "'Nothing is like winning'  Chelsea primed for Champions League defence",
                                        "With many climate activists unable to access vaccines, should Cop26 go ahead?",
                                        "Congress is on the cusp of passing the most pivotal bill in years – if we make them",
                                        "If Johnson is serious about ‘levelling up’, he needs to look at what Labour got right",
                                        "Rain fell on Greenland’s ice sheet for the first time ever known. Alarms should ring",
                                        "Condom ‘stealthing’ is a vile practice. California is right to ban it",
                                        "Give Lorde a break. Non-Māori must speak Māori for it to survive",
                                        "GPs are full of kindness and wisdom – so why do they face constant criticism?",
                                        "Freezing your eggs may be getting easier, but it’s no simple fertility fix",
                                        "‘We had little choice’  Volunteers clear up after German floods",
                                        "Olaf Scholz   \n                 \n                  \n                  Merit in society must not be limited to top-earners",
                                        "‘I will see the ghosts of the dead forest for a long time’   Returning to Evia after the wildfires",
                                        "Berlin’s bizarre new museum  A Prussian palace rebuilt for €680m",
                                        "'We need justice'  Four in 10 young people fear having children due to climate crisis",
                                        "EU  Leaked anti-deforestation law omits fragile grasslands and wetlands",
                                        "Greenhouse gases  Meat accounts for nearly 60% of all emissions from food production, study finds",
                                        "Texas  Hurricane Nicholas hits Texas coast with 20in of rain forecast",
                                        "Live  UK payrolls back to pre-pandemic levels amid record vacancies; global oil demand falls – business live",
                                        "Canada  Trudeau energized by anti-vaccine protests in election few wanted",
                                        "UK  Doctors' union drops opposition to assisted dying and adopts neutral stance",
                                        "Hillary Clinton  We face ‘real battle for democracy’ against far right",
                                        "Gavin Newsom  Political fate in balance as final votes cast in California recall",
                                        "Boris Johnson  PM’s mother, Charlotte Johnson Wahl, dies at 79",
                                        "Prince Andrew  Royal not properly served with Giuffre lawsuit, lawyers argue",
                                        "Norway election  Labour celebrates but coalition talks loom",
                                        "Alanis Morissette  Singer says she was victim of multiple statutory rapes as a teenager",
                                        "‘It’s the balm we need right now’  How Broadway fought its way back",
                                        "Book of the day  Souvenir by Michael Bracewell review – the London that time forgot",
                                        "Next stop, Zen  My strange life playing Bus Simulator 21",
                                        "London  Design Museum to host major Amy Winehouse retrospective",
                                        "Kazuki Yamada  City of Birmingham Symphony Orchestra names new chief conductor",
                                        "La Cha Cha review   Caravan park comedy is fun, for the cast",
                                        "Crunch time!  10 inspiring and unusual ways with cornflakes – from spicy upma to a tantalising tart",
                                        "Jamie Oliver   \n                 \n                  \n                  I prefer YouTube now to TV cookery shows",
                                        "A kitchen in Rome  Rachel Roddy’s recipe for rice salad",
                                        "Out damn spot!  How to save a piece of clothing from stubborn stains",
                                        "How we met  ‘It took until I was 48 years old to meet the handsome prince’",
                                        "Can do  Tinned fruit and vegetables are offensive no longer",
                                        "Dr Himali McInnes   \n                 \n                  \n                  We don’t live in isolation. Our ancestors’ trauma can affect our health generations later",
                                        "‘Every man was drinking’  How much do bans on alcohol help women in India?",
                                        "The Kaepernick Effect  A story of the other athletes who kneeled in protest",
                                        "‘Forever chemicals’  The hidden threat from the PFAS toxins on your shelf",
                                        "‘This is my country’  How the family of Balbir Singh Sodhi resolved to carry on his American dream",
                                        "'Strategic victory for Pakistan'  India weighs up new security risks in wake of Taliban takeover",
                                        "Notes and queries  Why does the sound of running water make us want to pee?",
                                        "Tell us  What was the moment that changed you?",
                                        "Living in Australia  Share your experience of coronavirus",
                                        "Get in touch  Share a story with the Guardian",
                                        "The weird, the wonderful and the political  Highlights from the 2021 Met Gala red carpet",
                                        "China's accidental feminist icon  'I left my abusive husband for a life on the road'",
                                        "Video  Curious southern right whale nudges paddleboarder",
                                        "Abba comeback  Band announce 'revolutionary' concert and brand new album",
                                        "California  Caldor fire burns on both sides of US Highway 50, footage shows",
                                        "Shipping  How megaships cause mega problems",
                                        "Haiti earthquake 10 days on  Survivors still 'hungry and thirsty'",
                                        "'Filthy Pride'  Marching for LGBTQ+ rights in Orbán's Hungary",
                                        "360 video  How racist propaganda inspired riots in America's biggest cities",
                                        "Why are they getting worse?   The climate science behind wildfires",
                                        "Sebastião Salgado  Brazilian receives Praemium Imperiale 2021 award",
                                        "‘It brought people back together’  The summer after 9/11",
                                        "Wrapping the Arc de Triomph and the pope in Slovakia  Monday’s best photos",
                                        "Snowflakes to slime mould  Nikon Small World Photomicrography 2021",
                                        "Selfies, serves and squirrels  The best photos from US Open 2021",
                                        "‘Ida is not the end’  Indigenous residents face the future on Louisiana’s coast – photo essay",
                                        "‘The virus is painfully real’: vaccine hesitant people are dying – and their loved ones want the world to listen",
                                        "Questions in Kabul as two top Taliban leaders ‘missing from public view’",
                                        "Covid booster jab to be offered to those at most risk and over-50s in UK",
                                        "China property giant Evergrande admits debt crisis as protesters besiege HQ",
                                        "Live  Coronavirus live news: Vladimir Putin self-isolating; new China outbreak grows",
                                        "Trudeau energized by anti-vaccine protests in Canada election few wanted",
                                        "Give Lorde a break. Non-Māori must speak Māori for it to survive",
                                        "New Zealand Māori party launches petition to change country’s name to Aotearoa",
                                        "We don’t live in isolation. Our ancestors’ trauma can affect our health generations later",
                                        "Fully vaccinated people account for 1.2% of England’s Covid-19 deaths"
                                    ],
                                    "h4": [
                                        "Panjshir valley Taliban accused of killing 20 civilians",
                                        "'Future is black' Taliban’s return ‘a catastrophe’ for journalism in Afghanistan, says IFJ",
                                        "Afghanistan Taliban takeover will reshape Middle East, official warns",
                                        "Panjshir valley Taliban accused of killing 20 civilians",
                                        "'Future is black' Taliban’s return ‘a catastrophe’ for journalism in Afghanistan, says IFJ",
                                        "Afghanistan Taliban takeover will reshape Middle East, official warns",
                                        "Fossil fuels The climate advocates who refuse to divest from big oil",
                                        "Fossil fuels The climate advocates who refuse to divest from big oil",
                                        "In pictures Stars explore ‘American independence’ theme",
                                        "Nicki Minaj  What's this about vaccines and swollen testicles?",
                                        "In pictures Stars explore ‘American independence’ theme",
                                        "Nicki Minaj  What's this about vaccines and swollen testicles?",
                                        "New Zealand Cases drop to 15 as Ardern unveils ‘Mr Whippy-style’ vaccination buses",
                                        "Covid passports What are European countries doing?",
                                        "China Cases double in new outbreak",
                                        "New Zealand Cases drop to 15 as Ardern unveils ‘Mr Whippy-style’ vaccination buses",
                                        "Covid passports What are European countries doing?",
                                        "China Cases double in new outbreak",
                                        "Emma Raducanu Murray: huge chance for British tennis",
                                        "Jonathan Liew Djokovic finally won the hearts of fans",
                                        "Emma Raducanu Murray: huge chance for British tennis",
                                        "Jonathan Liew Djokovic finally won the hearts of fans",
                                        "The Recap Sign up and get our email of editors' picks",
                                        "The Recap Sign up and get our email of editors' picks",
                                        "Rugby union Cooper set to be granted Australian citizenship",
                                        "Rugby union Cooper set to be granted Australian citizenship"
                                    ]
                                },
                                "description": "Latest international news, sport and comment from the Guardian",
                                "favicon": "https://assets.guim.co.uk/images/favicons/46bd2faa1ab438684a6d4528a655a8bd/32x32.ico",
                                "meta_keywords": null,
                                "canonical": "https://www.theguardian.com/international",
                                "internal_links_count": 193,
                                "external_links_count": 31,
                                "inbound_links_count": 15,
                                "images_count": 81,
                                "images_size": 1293022,
                                "scripts_count": 21,
                                "scripts_size": 350207,
                                "stylesheets_count": 3,
                                "stylesheets_size": 39814,
                                "title_length": 73,
                                "description_length": 62,
                                "render_blocking_scripts_count": 18,
                                "render_blocking_stylesheets_count": 26,
                                "cumulative_layout_shift": 0.019761060628380796,
                                "content": {
                                    "plain_text_size": 7032,
                                    "plain_text_rate": 0.006268267963107072,
                                    "plain_text_word_count": 1186,
                                    "automated_readability_index": 50.857568858909495,
                                    "coleman_liau_readability_index": null,
                                    "dale_chall_readability_index": 12.384409893198427,
                                    "flesch_kincaid_readability_index": -37.0519350758853,
                                    "smog_readability_index": 42.22421280198588,
                                    "description_to_content_consistency": 0.8888888955116272,
                                    "title_to_content_consistency": 1,
                                    "meta_keywords_to_content_consistency": null
                                },
                                "deprecated_tags": null,
                                "duplicate_meta_tags": null,
                                "spell": null,
                                "social_media_tags": {
                                    "og:url": "http://www.theguardian.com/international",
                                    "og:description": "Latest international news, sport and comment from the Guardian",
                                    "og:image": "https://assets.guim.co.uk/images/eada8aa27c12fe2d5afa3a89d3fbae0d/fallback-logo.png",
                                    "al:ios:url": "gnmguardian://international?contenttype=front&source=applinks",
                                    "og:type": "website",
                                    "al:ios:app_store_id": "409128287",
                                    "fb:app_id": "180444840287",
                                    "al:ios:app_name": "The Guardian",
                                    "og:site_name": "the Guardian",
                                    "twitter:app:id:iphone": "409128287",
                                    "twitter:app:name:googleplay": "The Guardian",
                                    "twitter:app:name:ipad": "The Guardian",
                                    "twitter:site": "@guardian",
                                    "twitter:app:url:ipad": "gnmguardian://international?contenttype=front&source=twitter",
                                    "twitter:card": "summary",
                                    "twitter:app:name:iphone": "The Guardian",
                                    "twitter:app:id:ipad": "409128287",
                                    "twitter:app:id:googleplay": "com.guardian",
                                    "twitter:app:url:iphone": "gnmguardian://international?contenttype=front&source=twitter",
                                    "twitter:dnt": "on",
                                    "fb:pages": "10513336322",
                                    "twitter:url": "https://www.theguardian.com/international",
                                    "og:title": "News, sport and opinion from the Guardian's global edition | The Guardian"
                                }
                            },
                            "page_timing": {
                                "time_to_interactive": 364,
                                "dom_complete": 364,
                                "largest_contentful_paint": 162.4,
                                "first_input_delay": 0.7000007629394531,
                                "connection_time": 0,
                                "time_to_secure_connection": 0,
                                "request_sent_time": 0,
                                "waiting_time": 0,
                                "download_time": 0,
                                "duration_time": 0,
                                "fetch_start": 0,
                                "fetch_end": 0
                            },
                            "onpage_score": 87.93,
                            "total_dom_size": 4275498,
                            "custom_js_response": null,
                            "resource_errors": null,
                            "broken_resources": false,
                            "broken_links": false,
                            "duplicate_title": false,
                            "duplicate_description": false,
                            "duplicate_content": false,
                            "click_depth": 0,
                            "size": 1122197,
                            "encoded_size": 194962,
                            "total_transfer_size": 194962,
                            "fetch_time": "2021-09-14 15:15:28 +00:00",
                            "cache_control": {
                                "cachable": true,
                                "ttl": 60
                            },
                            "checks": {
                                "no_content_encoding": false,
                                "high_loading_time": false,
                                "is_redirect": false,
                                "is_4xx_code": false,
                                "is_5xx_code": false,
                                "is_broken": false,
                                "is_www": true,
                                "is_https": true,
                                "is_http": false,
                                "high_waiting_time": false,
                                "no_doctype": false,
                                "canonical": true,
                                "no_encoding_meta_tag": false,
                                "no_h1_tag": false,
                                "https_to_http_links": false,
                                "has_html_doctype": true,
                                "size_greater_than_3mb": false,
                                "meta_charset_consistency": true,
                                "has_meta_refresh_redirect": false,
                                "has_render_blocking_resources": true,
                                "redirect_chain": false,
                                "low_content_rate": true,
                                "high_content_rate": false,
                                "low_character_count": false,
                                "high_character_count": false,
                                "small_page_size": false,
                                "large_page_size": true,
                                "low_readability_rate": true,
                                "irrelevant_description": false,
                                "irrelevant_title": false,
                                "irrelevant_meta_keywords": false,
                                "title_too_long": true,
                                "title_too_short": false,
                                "deprecated_html_tags": false,
                                "duplicate_meta_tags": false,
                                "duplicate_title_tag": false,
                                "no_image_alt": true,
                                "no_image_title": true,
                                "no_description": false,
                                "no_title": false,
                                "no_favicon": false,
                                "seo_friendly_url": false,
                                "flash": false,
                                "frame": true,
                                "lorem_ipsum": false,
                                "seo_friendly_url_characters_check": true,
                                "seo_friendly_url_dynamic_check": true,
                                "seo_friendly_url_keywords_check": false,
                                "seo_friendly_url_relative_length_check": true,
                                "recursive_canonical": false,
                                "canonical_chain": false,
                                "canonical_to_redirect": false,
                                "canonical_to_broken": false,
                                "has_links_to_redirects": false,
                                "is_orphan_page": false,
                                "is_link_relation_conflict": true
                            },
                            "content_encoding": "gzip",
                            "media_type": "text/html",
                            "server": null,
                            "is_resource": false
                        }
                    ]
                }
            ]
        }
    ]
}

Exit mobile version