OnPage

‌The OnPage Lighthouse API is based on Google’s open-source Lighthouse project for measuring the quality of web pages and web apps.

post/v3/on_page/lighthouse/live/json

Request

  • Base URL: https://api.dataforseo.com
  • URL: https://api.dataforseo.com/v3/on_page/lighthouse/live/json
  • Auth: HTTP basic

Request body

urlstring

<em>target URL</em><br><strong>required field</strong><br>target page should be specified with its absolute URL (including http:// or https://)<br>example:<br><code>https://dataforseo.com/</code>

for_mobileboolean nullable

<em>applies mobile emulation</em><br>optional field<br>if set to <code>true</code>, Lighthouse will use mobile device and screen emulation to test the page against mobile environment<br>if set to <code>false</code>, the results will be provided for desktop<br>default value: <code>false</code>

categoriesstring[] nullable

<em>categories of Lighthouse audits</em><br>optional field<br>each category is a collection of audits and audit groups that applies weighting and scoring to the section (<a href="https://github.com/GoogleChrome/lighthouse/blob/master/docs/architecture.md#auditreport-terminology" rel="noopener noreferrer" target="_blank">see official definition</a>)<p><strong>if you ignore this field, we will return data for all categories unless you specify <code>audits</code></strong><br>use this field to get data for specific categories you indicate here<p>possible values:<br><code>seo</code>, <code>performance</code>, <code>best_practices</code>, <code>accessibility</code>

auditsstring[] nullable

<em>Lighthouse audits</em><br>optional field<br>audits are individual tests Lighthouse runs for each specific feature/optimization/metric to produce a numeric score (<a href="https://github.com/GoogleChrome/lighthouse/blob/master/docs/architecture.md#components--terminology" rel="noopener noreferrer" target="_blank">see official definition</a>); <p><strong>if you ignore this field, we will return data for all audits</strong>;<br>use this field to get data for specific audits you indicate here;<p><strong>Note:</strong> that some audits do not belong to a specific category and are stand-alone page quality measurements;<p>in general, there can be several use cases:<p>1. if you ignore <code>categories</code>, you can use this field to get data for the specified audits only<br>for example, if you ignore <code>"categories"</code> and specify <code>"audits": ["metrics/cumulative-layout-shift","metrics/largest-contentful-paint","metrics/total-blocking-time"]</code>, you will get data only for these audits<p>2. if you specify a category, you can use this field to additionally receive audits that do not belong to the category(-ies) you specified<br>for example, if you specify <code>"categories": ["seo"]</code> and <code>"audits": ["metrics/cumulative-layout-shift","metrics/largest-contentful-paint","metrics/total-blocking-time"]</code>, you will get only these audits under "performance" and all audits under "seo"<p>you can get <a href="/v3/on_page/lighthouse/audits/">the full list of possible audits here</a>

versionstring nullable

<em>lighthouse version</em><br>optional field<br>you can obtain the results specific to a certain Lighthouse version by specifying its number<br>the list of available versions is available through the <a href="/v3/on_page/lighthouse/versions/" rel="noopener noreferrer" target="_blank">Lighthouse Versions endpoint</a>

language_namestring nullable

<em>lighthouse language name</em><br>optional field<br>you can receive the list of available languages of the search engine with their <code>language_name</code> by making a separate request to <code>https://api.dataforseo.com/v3/on_page/lighthouse/languages</code><br>default value:<br><code class="long-string">English</code>

language_codestring nullable

<em>lighthouse language code</em><br>optional field<br>you can receive the list of available languages of the search engine with their <code>language_code</code> by making a separate request to <code>https://api.dataforseo.com/v3/on_page/lighthouse/languages</code><br>default value:<br><code class="long-string">en</code>

custom_user_agentstring nullable

<em>custom user agent</em><br>optional field<br>specify the custom user agent used by the browser when running the Lighthouse audit;<br>can be specified with up to 254 characters;

browser_screen_widthinteger nullable

<em>browser screen width</em><br>optional field<br>set the screen width of the browser used for the Lighthouse audit to emulate a specific device;<br>can be specified within the following range: <code>240–9999</code>;

browser_screen_heightinteger nullable

<em>browser screen height</em><br>optional field<br>set the screen height of the browser used for the Lighthouse audit to emulate a specific device;<br>can be specified within the following range: <code>240–9999</code>;

browser_screen_scale_factornumber nullable

<em>browser screen scale factor</em><br>optional field<br>set the device pixel ratio of the browser used for the Lighthouse audit;<br>can be specified within the following range: <code>0.5–3</code>;

browser_network_throttling_methodstring nullable

<em>browser network throttling method</em><br>optional field<br>defines the method used to apply throttling during the Lighthouse audit;<br>possible vaules:<br><code>simulate</code> - calculates estimated performance metrics without applying explicit throttling;<br><code>devtools</code> - applies the throttling settings specified in <code>browser_network_throttling</code> and <code>browser_cpu_throttling_multiplier</code>;<br><code>provided</code> - uses the network conditions of the crawling environment;

browser_cpu_throttling_multipliernumber nullable

<em>browser CPU throttling multiplier</em><br><strong>required if <code>browser_network_throttling_method</code> is set to <code>devtools</code>;</strong><br>set the CPU throttling multiplier to simulate device performance conditions during the Lighthouse audit;<br>can be specified within the following range: <code>1–4</code>;<br><strong>Note:</strong> this parameter is applied only when <code>browser_network_throttling_method</code> is set to <code>devtools</code>;

browser_network_throttlingstring nullable

<em>browser network throttling</em><br><strong>required if <code>browser_network_throttling_method</code> is set to <code>devtools</code>;</strong><br>set the network throttling profile to simulate connection speed conditions during the Lighthouse audit;<br>possible values: <code>no_throttling</code>, <code>fast_4g</code>, <code>slow_4g</code>, <code>regular_3g</code>, <code>pc</code>;<br><strong>Note:</strong> this parameter is applied only when <code>browser_network_throttling_method</code> is set to <code>devtools</code>;

tagstring nullable

<em>user-defined task identifier</em><br>optional field<br><em>the character limit is 255</em><br>you can use this parameter to identify the task and match it with the result<br>you will find the specified <code>tag</code> value in the <code>data</code> object of the response

Example request

[
  {
    "url": "https://dataforseo.com",
    "for_mobile": true,
    "tag": "some_string_123"
  }
]

Response

Successful operation

versionstring nullable

the current version of the API

status_codeinteger nullable

general status code you can find the full list of the response codes here

status_messagestring nullable

general informational message you can find the full list of general informational messages here

timestring nullable

total execution time, seconds

costnumber double nullable

total tasks cost, USD

tasks_countinteger nullable

the number of tasks in the tasks array

tasks_errorinteger nullable

the number of tasks in the tasks array returned with an error

Changes

    • info

      added the new optional request property /////

    • info

      added the new optional request property /////

    • info

      added the new optional request property /////

    • info

      added the new optional request property /////

    • info

      added the new optional request property /////

    • info

      added the new optional request property /////

    • info

      added the new optional request property /////

    • info

      api operation id OnPageLighthouseLiveJson removed and replaced with LighthouseLiveJson