Skip to content

Instantly share code, notes, and snippets.

@mucahitnezir
Created June 23, 2021 10:12
Show Gist options
  • Save mucahitnezir/1676e467bb8dcaff9b8b17b603b0155d to your computer and use it in GitHub Desktop.
Save mucahitnezir/1676e467bb8dcaff9b8b17b603b0155d to your computer and use it in GitHub Desktop.
PageSpeed Insights API
const axios = require('axios');
const config = {
method: 'get',
url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
params: {
key: '<YOUR_GOOGLE_API_KEY>',
url: 'https://mucahitnezir.com',
locale: 'tr'
},
headers: {
'Content-Type': 'application/json'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment