agonyz/contao-page-speed-insights-bundle

Automatically get page speed insights for pages

2.0.2 2023-07-15 14:45 UTC

This package is auto-updated.

Last update: 2024-03-31 01:14:31 UTC


README

Extension for the Contao CMS

This extension can be used to automatically track the page speed insights for your root domains.

For a Quick-Setup follow this link: Guide-For-Quick-Setup

Installation

Run composer require agonyz/contao-page-speed-insights-bundle in your CLI to install the extension.

Configuration

To use the Page Speed Insights API you need to register an Api Key.
You can edit the configuration in your config/config.yml

# config/config.yml
# Agonyz Page Speed Insights
agonyz_contao_page_speed_insights:
  api_key: your-secret-api-key 
  request_retries: 3 # retries for each strategy (desktop & mobile)
  pool_request_concurrency: 10 # indicates how many requests are sent simultaneously
  request_pagination: 15 # indicates how many requests are shown in the overview per page
  request_status_refresh_rate: 5000 # duration for the ajax request to check the status of the current process

Please remember to always clear the cache after each change in the config.yml.
It may be also needed to delete the cached results via command after changes in the config file.

Choose which pages to track

In the root page configuration navigate to Page Speed Insights Bundle and tick the checkbox.

Commands & Cronjob

Commands

  • agonyz-page-speed-insights:request - generates new request results and saves them to the database

Cronjob

You can either implement your own cronjob or use contao cron

Via Command

  • Create a cronjob that executes the agonyz-page-speed-insights:request - Command

Via Cron

  • Configurate Agonyz\ContaoPageSpeedInsightsBundle\Cron\PageSpeedInsightsCron in your config/services.yml

Example:

# Cronjob
services:
  Agonyz\ContaoPageSpeedInsightsBundle\Cron\PageSpeedInsightsCron:
    tags:
      -
        name: contao.cronjob
        interval: '0 */24 * * *'
    arguments:
      [ '@contao.framework', '@Agonyz\ContaoPageSpeedInsightsBundle\Service\Request\RequestHandler']

Documentation: https://docs.contao.org/dev/framework/cron/#using-service-tagging

Page Speed Insights

In the backend navigate to the Pagespeed-Insights - entry point.

psibundle