There is currently no built-in function for retrieving the most popular pages. However, there is an Deki API function which can be invoked from DekiScript!
For this sample, we use uri.build to build the URI from the site.api URi. Then, we use web.xml to fetch the document from it (see what the XML looks like). Now, we iterate over all <page> elements in the document and print out foreach the link, title, and view count using xml.text.
<ul block="var pages = web.xml(uri.build(site.api, ['pages', 'popular'], {}))['page']">
<li foreach="var p in pages" where="__count < 10">{{ web.link(uri.build(site.uri, "index.php", { title: xml.text(p, 'path') ?? "" }), xml.text(p, 'title')) }} ({{ num.format(xml.text(p, 'metrics/metric.views'), '#,#00') }} views)</li>
</ul>
Sample output