GoogleChromeLabs/psi Google Page Speed Insight

GoogleChromeLabs/psi

Allow, bertemu kembali, pada kali ini akan menjelaskan tentang google page speed insight GoogleChromeLabs/psi simak selengkapnya

PageSpeed Insights with reporting

GoogleChromeLabs/psi

Run movable and desktop performance tests intended your deployed site using with tidy writing intended your make process.

Install

$ npm install psi

Usage

const psi = require('psi');

(async () => 
  // Get the PageSpeed Insights report
  const data = await psi('https://theverge.com');
  console.log(data.ruleGroups.SPEED.score);
  console.log(data.pageStats);

  // Output a formatted report to the terminal
  await psi.output('https://theverge.com');
  console.log('Done');

  // Supply options to PSI and get back speed and usability scores
  const data2 = await psi('https://theverge.com', 
    nokey: 'true',
    strategy: 'mobile'
  );
  console.log('Speed score:', data.ruleGroups.SPEED.score);
  console.log('Usability score:', data.ruleGroups.USABILITY.score);
)();

As of PSI 2.x, we show both the PageSpeed Insights speed and usability scores. The last is based supported by .

API

psi(url, [options])

Returns a promise intended the response details from Google PageSpeed Insights.

GoogleChromeLabs/psi

url

Type: string

URL of the page intended which the PageSpeed Insights API should generate results.

options

Type: Object

key

Type: string

Default: Free tier

GoogleChromeLabs/psi

When using this module intended a production-level make process, registering intended an API key from the is recommended.

strategy

Type: string

Default: mobile

Values: mobile desktop

Strategy to utilize when analyzing the page.

locale

Type: string

Default: en_US

GoogleChromeLabs/psi

Locale results should be generated in.

threshold

Type: number

Default: 70

Threshold score to go by or past the PageSpeed test. Useful intended surroundings a performance budget.

psi.output(url, [options])

Output the formatted report to the terminal.

GoogleChromeLabs/psi

Returns a promise intended the response details from Google PageSpeed Insights.

url and options are the same while psi().

CLI

$ npm install --global psi
$ psi --help

  Usage
    $ psi <url>

  Options
    --key        Google API Key. By want the for free tier is used
    --strategy   Strategy to utilize when analyzing the page: mobile|desktop
    --format     Output format: cli|json|tap
    --locale     Locale results should be generated in
    --threshold  Threshold score to go by or past the PageSpeed test

  Example
    $ psi https://addyosmani.com --strategy=mobile

Getting PSI into your make process

A example project using PSI is available.

If you utilize Grunt, is a job by James Cryer that uses PSI below the hood.

GoogleChromeLabs/psi

For difficult community projects, we recommend using .

License

Apache-2.0 - Copyright 2015 Google Inc

https://github.com/GoogleChromeLabs/psi

Begitulah detil tentang GoogleChromeLabs/psi semoga artikel ini bermanfaat terima kasih

Artikel ini diposting pada label google page speed insight, google page speed insights user agent, google pagespeed insights logo,

Komentar