SlideShare ist ein Scribd-Unternehmen logo
1 von 7
Manual Google PageSpeed
Install google APIS node.js
npm install googleapis --save
Install PageSpeed Insights with reporting
npm install --save psi
Usage
var psi = require('psi');
// get the PageSpeed Insights report
psi('html5rocks.com', function (err, data) {
console.log(data.score);
console.log(data.pageStats);
});
// output a formatted report to the terminal
psi.output('html5rocks.com', function (err) {
console.log('done');
});
API
psi(url, [options], callback)
url
Required
Type: string
URL of the page for which the PageSpeed Insights API should generate results.
options
Type: object
key
Type: string
Default: Free tier
When using this module for a production-level build process, registering for an API
key from theGoogle Developer Console is recommended.
strategy
Type: string
Default: mobile
Values: mobile, desktop
Strategy to use when analyzing the page.
locale
Type: string
Default: en_US
Locale results should be generated in.
threshold
Type: number
Default: 70
Threshold score to pass the PageSpeed test.
callback(error, data)
Required
Type: function
data
Type: object
The response from Google PageSpeed Insights.
psi.output(url, [options], [callback])
Output the formatted report to the terminal.
url and options is the same as psi().
callback(error)
Type: function
Install CLI
$ npm install --global psi
$ psi --help
Usage
psi <url> <options>
Example
psi todomvc.com --strategy=mobile
Options
--key Google API Key. By default the free tier is used.
--strategy Strategy to use when analyzing the page: mobile|desktop
--format Output format: cli|json|tap
--locale Locale results should be generated in.
--threshold Threshold score to pass the PageSpeed test.
Install grunt-pagespeed
npm install grunt-pagespeed --save-dev
Loading the plugin
Add this to your project's Gruntfile.js gruntfile:
grunt.loadNpmTasks('grunt-pagespeed');
Or, add this to your project's Gruntfile.coffee gruntfile:
grunt.loadNpmTasks 'grunt-pagespeed'
Alternatively use load-grunt-tasks to load your plugins.
require('load-grunt-tasks')(grunt);
Pagespeed task
Run this task with the grunt pagespeed command.
This task is a multi task so any targets, files and options should be specified
according to the multi taskdocumentation.
Usage Example
pagespeed: {
options: {
nokey: true,
url: "https://developers.google.com"
},
prod: {
options: {
url:
"https://developers.google.com/speed/docs/insights/v1/getting_started",
locale: "en_GB",
strategy: "desktop",
threshold: 80
}
},
paths: {
options: {
paths: ["/speed/docs/insights/v1/getting_started", "/speed/docs/about"],
locale: "en_GB",
strategy: "desktop",
threshold: 80
}
}
}
Options
nokey
Type: Boolean
Use the nokey option to test-drive PageSpeed Insights before acquiring a key for
production builds.
key
Type: String
Google API Key
url
Type: String
The URL of the page for which the PageSpeed Insights API should generate
results.
Target Properties
url
Type: String
The URL of the page for which the PageSpeed Insights API should generate
results.
locale
Type: String
The locale that results should be generated in. This is mandatory.
strategy
Type: String
The strategy to use when analyzing the page. Valid values are desktop and mobile.
threshold
Type: Number
Threshold score that is needed to pass the pagespeed test
paths
Type: Array
An array of URL paths that are appended to the URL
Sample output
The grunt task outputs the results as follows if everything passes:
If the task fails to pass the threshold, then it ouputs something similar to the image
below:
Manual google page speed

Weitere ähnliche Inhalte

Was ist angesagt?

Makefiles for automating image processing
Makefiles for  automating  image processingMakefiles for  automating  image processing
Makefiles for automating image processing
Shweta Sadawarte
 

Was ist angesagt? (19)

Gulp - The Streaming Build System
Gulp - The Streaming Build SystemGulp - The Streaming Build System
Gulp - The Streaming Build System
 
HPEC 2021 grblas
HPEC 2021 grblasHPEC 2021 grblas
HPEC 2021 grblas
 
Portable class library to .NET Standard Extension
Portable class library to .NET Standard ExtensionPortable class library to .NET Standard Extension
Portable class library to .NET Standard Extension
 
Dev toolkit: Ferramentas para melhorar a qualidade do seu projeto
Dev toolkit: Ferramentas para melhorar a qualidade do seu projetoDev toolkit: Ferramentas para melhorar a qualidade do seu projeto
Dev toolkit: Ferramentas para melhorar a qualidade do seu projeto
 
Optimizing and Deploying Angular
Optimizing and Deploying AngularOptimizing and Deploying Angular
Optimizing and Deploying Angular
 
Replacing Rails asset pipeline with Gulp
Replacing Rails asset pipeline with GulpReplacing Rails asset pipeline with Gulp
Replacing Rails asset pipeline with Gulp
 
I am-one-with-angular
I am-one-with-angularI am-one-with-angular
I am-one-with-angular
 
Automating your workflow with Gulp.js
Automating your workflow with Gulp.jsAutomating your workflow with Gulp.js
Automating your workflow with Gulp.js
 
Web performance tools @ WebPerf.camp 2016
Web performance tools @ WebPerf.camp 2016Web performance tools @ WebPerf.camp 2016
Web performance tools @ WebPerf.camp 2016
 
Automating Large Applications on Modular and Structured Form with Gulp
Automating Large Applications on Modular and Structured Form with GulpAutomating Large Applications on Modular and Structured Form with Gulp
Automating Large Applications on Modular and Structured Form with Gulp
 
Gulp and bower Implementation
Gulp and bower Implementation Gulp and bower Implementation
Gulp and bower Implementation
 
Groovy on Google App Engine with Gaelyk
Groovy on Google App Engine with GaelykGroovy on Google App Engine with Gaelyk
Groovy on Google App Engine with Gaelyk
 
So you want to write a cloud function
So you want to write a cloud functionSo you want to write a cloud function
So you want to write a cloud function
 
Kubeflow on google kubernetes engine
Kubeflow on google kubernetes engineKubeflow on google kubernetes engine
Kubeflow on google kubernetes engine
 
JVM Web Frameworks Exploration
JVM Web Frameworks ExplorationJVM Web Frameworks Exploration
JVM Web Frameworks Exploration
 
Cheap HPC
Cheap HPCCheap HPC
Cheap HPC
 
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow IntroductionGCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
 
Desktop Summit 2011 Talk
Desktop Summit 2011 TalkDesktop Summit 2011 Talk
Desktop Summit 2011 Talk
 
Makefiles for automating image processing
Makefiles for  automating  image processingMakefiles for  automating  image processing
Makefiles for automating image processing
 

Ähnlich wie Manual google page speed

Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
fool2nd
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
維佋 唐
 

Ähnlich wie Manual google page speed (20)

Grunt & Front-end Workflow
Grunt & Front-end WorkflowGrunt & Front-end Workflow
Grunt & Front-end Workflow
 
Google Gears
Google GearsGoogle Gears
Google Gears
 
JLPDevs - Optimization Tooling for Modern Web App Development
JLPDevs - Optimization Tooling for Modern Web App DevelopmentJLPDevs - Optimization Tooling for Modern Web App Development
JLPDevs - Optimization Tooling for Modern Web App Development
 
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
DevFest 2022 - GitHub Actions를 활용한 Flutter 배포 자동화하기
 
Golang Project Layout and Practice
Golang Project Layout and PracticeGolang Project Layout and Practice
Golang Project Layout and Practice
 
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fastHow Bitbucket Pipelines Loads Connect UI Assets Super-fast
How Bitbucket Pipelines Loads Connect UI Assets Super-fast
 
Introduction to Django
Introduction to DjangoIntroduction to Django
Introduction to Django
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Web development - technologies and tools
Web development - technologies and toolsWeb development - technologies and tools
Web development - technologies and tools
 
Introduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google CloudIntroduction to Cloud Computing with Google Cloud
Introduction to Cloud Computing with Google Cloud
 
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
Technical Tips: Visual Regression Testing and Environment Comparison with Bac...
 
Gae Meets Django
Gae Meets DjangoGae Meets Django
Gae Meets Django
 
Parse cloud code
Parse cloud codeParse cloud code
Parse cloud code
 
Node in Production at Aviary
Node in Production at AviaryNode in Production at Aviary
Node in Production at Aviary
 
Infrastructure Management in GCP
Infrastructure Management in GCPInfrastructure Management in GCP
Infrastructure Management in GCP
 
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko "Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
"Modern DevOps & Real Life Applications. 3.0.0-devops+20230318", Igor Fesenko
 
Laravel5 Introduction and essentials
Laravel5 Introduction and essentialsLaravel5 Introduction and essentials
Laravel5 Introduction and essentials
 
MongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQuery
MongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQueryMongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQuery
MongoDB Europe 2016 - Warehousing MongoDB Data using Apache Beam and BigQuery
 
How We Build NG-MY Websites: Performance, SEO, CI, CD (Thai version)
How We Build NG-MY Websites: Performance, SEO, CI, CD (Thai version)How We Build NG-MY Websites: Performance, SEO, CI, CD (Thai version)
How We Build NG-MY Websites: Performance, SEO, CI, CD (Thai version)
 
How We Build NG-MY Websites: Performance, SEO, CI, CD
How We Build NG-MY Websites: Performance, SEO, CI, CDHow We Build NG-MY Websites: Performance, SEO, CI, CD
How We Build NG-MY Websites: Performance, SEO, CI, CD
 

Kürzlich hochgeladen

Kürzlich hochgeladen (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

Manual google page speed

  • 1. Manual Google PageSpeed Install google APIS node.js npm install googleapis --save Install PageSpeed Insights with reporting npm install --save psi Usage var psi = require('psi'); // get the PageSpeed Insights report psi('html5rocks.com', function (err, data) { console.log(data.score); console.log(data.pageStats); }); // output a formatted report to the terminal psi.output('html5rocks.com', function (err) { console.log('done'); }); API psi(url, [options], callback) url Required Type: string URL of the page for which the PageSpeed Insights API should generate results. options Type: object key
  • 2. Type: string Default: Free tier When using this module for a production-level build process, registering for an API key from theGoogle Developer Console is recommended. strategy Type: string Default: mobile Values: mobile, desktop Strategy to use when analyzing the page. locale Type: string Default: en_US Locale results should be generated in. threshold Type: number Default: 70 Threshold score to pass the PageSpeed test. callback(error, data) Required Type: function data Type: object The response from Google PageSpeed Insights. psi.output(url, [options], [callback]) Output the formatted report to the terminal. url and options is the same as psi().
  • 3. callback(error) Type: function Install CLI $ npm install --global psi $ psi --help Usage psi <url> <options> Example psi todomvc.com --strategy=mobile Options --key Google API Key. By default the free tier is used. --strategy Strategy to use when analyzing the page: mobile|desktop --format Output format: cli|json|tap --locale Locale results should be generated in. --threshold Threshold score to pass the PageSpeed test. Install grunt-pagespeed npm install grunt-pagespeed --save-dev Loading the plugin Add this to your project's Gruntfile.js gruntfile: grunt.loadNpmTasks('grunt-pagespeed'); Or, add this to your project's Gruntfile.coffee gruntfile: grunt.loadNpmTasks 'grunt-pagespeed' Alternatively use load-grunt-tasks to load your plugins. require('load-grunt-tasks')(grunt); Pagespeed task Run this task with the grunt pagespeed command.
  • 4. This task is a multi task so any targets, files and options should be specified according to the multi taskdocumentation. Usage Example pagespeed: { options: { nokey: true, url: "https://developers.google.com" }, prod: { options: { url: "https://developers.google.com/speed/docs/insights/v1/getting_started", locale: "en_GB", strategy: "desktop", threshold: 80 } }, paths: { options: { paths: ["/speed/docs/insights/v1/getting_started", "/speed/docs/about"], locale: "en_GB", strategy: "desktop", threshold: 80 } } } Options nokey Type: Boolean Use the nokey option to test-drive PageSpeed Insights before acquiring a key for production builds. key Type: String Google API Key url Type: String
  • 5. The URL of the page for which the PageSpeed Insights API should generate results. Target Properties url Type: String The URL of the page for which the PageSpeed Insights API should generate results. locale Type: String The locale that results should be generated in. This is mandatory. strategy Type: String The strategy to use when analyzing the page. Valid values are desktop and mobile. threshold Type: Number Threshold score that is needed to pass the pagespeed test paths Type: Array An array of URL paths that are appended to the URL Sample output The grunt task outputs the results as follows if everything passes:
  • 6. If the task fails to pass the threshold, then it ouputs something similar to the image below: