Skip to main content

Wagtail Metrics

https://img.shields.io/pypi/v/wagtail_metrics https://img.shields.io/pypi/pyversions/wagtail_metrics

Wagtail Metrics allows you to retrieve information about Wagtail pages.

Information providers for Wagtail pages are :

  • wagtail_page : retrieves all fields and blocks

  • request : get the HTTP status code of Wagtail pages

  • google_page_speed : collects scores on performance, accessibility, best practices and SEO

Usage

You can use Wagtail Metrics like this :

from wagtail.core.models import Site
from wagtail_metrics.checkup import Checkup

checkup = Checkup(providers=[
        'wagtail_page',
        'request',
        'google_page_speed'
])
for site in Site.objects.all():
    checkup.add_site(site)
checkup_json = checkup.to_json()

checkup_json is equal to :

{
    "stream_field__block__title": {
        "counter": 3,
        "values": {
            "generic title": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "stream_field__block__description": {
        "counter": 3,
        "values": {
            "different description 1": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "different description 2": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "different description 3": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "locale": {
        "counter": 3,
        "values": {
            "french": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "title": {
        "counter": 3,
        "values": {
            "Home": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "CMS": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "Wagtail": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "slug": {
        "counter": 3,
        "values": {
            "home": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "cms": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "wagtail": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "live": {
        "counter": 3,
        "values": {
            "true": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "owner": {
        "counter": 3,
        "values": {
            "none": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "seo_title": {
        "counter": 3,
        "values": {
            "": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "show_in_menus": {
        "counter": 3,
        "values": {
            "false": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "search_description": {
        "counter": 3,
        "values": {
            "": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "first_published_at": {
        "counter": 3,
        "values": {
            "none": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "last_published_at": {
        "counter": 3,
        "values": {
            "none": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "char_field": {
        "counter": 3,
        "values": {
            "Test char field": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "request__status_code": {
        "counter": 3,
        "values": {
            "200": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page_speed__performance": {
        "counter": 3,
        "values": {
            "99": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "84": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "75": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page_speed__accessibility": {
        "counter": 3,
        "values": {
            "95": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page_speed__best_practices": {
        "counter": 3,
        "values": {
            "100": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page__speed_seo": {
        "counter": 3,
        "values": {
            "100": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "stream_field__block_never_used__title": {
        "counter": 0,
        "values": {}
    }
}

Setup

Install with pip :

pip install wagtail_metrics

Set if needed in Django settings :

# Default value
WAGTAIL_METRICS_DEFAULT_EXCLUDE = [
    'sites_rooted_here',
    'aliases',
    'revisions',
    'group_permissions',
    'view_restrictions',
    'workflow_states',
    'wagtail_admin_comments',
    'subscribers',
    'id',
    'path',
    'depth',
    'numchild',
    'translation_key',
    'draft_title',
    'has_unpublished_changes',
    'url_path',
    'go_live_at',
    'expire_at',
    'expired',
    'locked',
    'locked_at',
    'locked_by',
    'latest_revision_created_at',
    'live_revision',
    'alias_of',
    'page_ptr',
    'index_entries',
    'content_type'
]
WAGTAIL_METRICS_INDENT_JSON = 4
# For Google page speed
WAGTAIL_METRICS_GOOGLE_API_KEY = 'xxx'

Metadata

Release files for wagtail-metrics 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-metrics 0.0.11
File Size Uploaded Provenance
wagtail_metrics-0.0.11.tar.gz 24.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-metrics 0.0.11
File Interpreter ABI Platform
wagtail_metrics-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 52.3 kB

Release files / wagtail_metrics-0.0.11.tar.gz

Download URL wagtail_metrics-0.0.11.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3cddd8de10f5d3b883a916cafa7fa15e63b605d96909f61a79000df914d16db0
BLAKE2b-256 checksum
How to use checksums
8231b0701cd7a35930ab8b9707d39a249edc04d91f88dcb080f1cb73e8d7c215
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / wagtail_metrics-0.0.11-py3-none-any.whl

Download URL wagtail_metrics-0.0.11-py3-none-any.whl
Size 27.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e4287a93a8e3a588c1c76d664e661cf482882fa6a4e21c62af94a26eda5b1681
BLAKE2b-256 checksum
How to use checksums
c76ae5ec9bd8edc776c5eb9f2defa1c92c92b693132cbe8498cef9bbb06e7930
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for wagtail-metrics 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page