Google PageSpeed Insights API: No Connector Required

Google’s PageSpeed Insights API reports on the performance of a page on both mobile and desktop devices, and provides suggestions on how that page may be improved. The service works with a simple URL request and requires only a static API key for volume use. The Read Text/Web File function in the Analytics Edge Add-in lets you make these types of web queries — no need for a special connector.

In it’s simplest form, enter the full URL into the File/URL field in the Read Test/Web File wizard and select JSON file format for the response.

The response will come back which you can then process with other macro functions as desired.

Unknown Response Format (or Errors)

If you aren’t sure about the format of the response (or it doesn’t seem to work), change the format to Split on delimiter: New line.

You should be able to see the full response (or error) from the query and decide what to do next.

Keeping Partial JSON Responses

For JSON formatted outputs, if there is a top node, or if you want to keep only data below a specific node, enter the node name in the query. Only JSON nodes below that point will be read.

Using Values From A Worksheet

If you want to enter the query values in a worksheet, use a Read Worksheet function to get the fields you want…

… then reference the column names [in square brackets] in the Read Text/Web File wizard.

This technique can also be used with a Repeat Macro to process a series of queries, appending the results to a common worksheet.

A Generic Capability

This technique works for other URL-based API’s and API’s that use static API keys, such as Sistrix. Use other Analytics Edge macros and macro functions to prepare the parameters for the queries and to process the results. The possibilities are endless. Enjoy!