How to check feature/content-source usage using pb-data analysis scripts
Tracking features and content sources in PageBuilder
In PageBuilder, identifying the origins of features and content sources is crucial when planning development work on existing features or content sources.
Itβs often not easy to understand where these elements are used and how often they are used. Weβll talk about a method to explore PageBuilder data using series of shell scripts in your local development environment.
We published a recipe repository with example scripts containing a few different scripts that can provide insights about your features and content sources.
Video demo and tutorial
Set up
- Clone this repo: https://github.com/arcxp/pb-data-analysis-scripts
- Install two command line tools these scripts uses:
- Mongodb Tools - convert
bson
tojsonl
files - Duckdb CLI - allows running SQLs over CSV or JSONL files
- Mongodb Tools - convert
- Download pb-data from your Arc Admin > PageBuilder > Developer Tools > PB-Data, then untar the package, rename the folder to pb-data and place it in the root folder of this repoβs working copy on your machine
- Run prepare script:
sh _prepare.sh
.
Youβre now ready to run any of the scripts in this repository.
Scripts
Show all features usage analytics
sh all-features-usage.sh
This script lists all features used in your pb-data (not bundle), in published pages, and templates along with how many pages they are used in and the number of times (instances) they are used in these pages.
Example output of this script
\--- All features used in published pages, sorted by most used first ---
ββββββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ featureName β countOfTimesUsed β countOfPagesOrTemplatesUsing ββ varchar β int64 β int64 βββββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββ€β form/contact-form β 711 β 48 ββ hero/default β 768 β 47 ββ form/contact-us-handler β 219 β 44 ββ alternating-image/alternating-image β 1715 β 40 ββ resources/latestResources β 462 β 34 ββ vertical-icon-grid/default β 400 β 23 ββ billboard/default β 477 β 21 ββ story/default β 531 β 20 ββ horizontal-card-grid/default β 183 β 12 ββ spacer/default β 110 β 9 ββ user-card-grid/default β 159 β 8 ββ logo-grid/default β 140 β 7 ββ resources/resources-v2 β 67 β 6 ββ alternating-video/default β 52 β 5 ββ cardpromo/card-promo β 122 β 4 ββ imagepromo/image-promo β 36 β 4 ββ form/form-handler β 51 β 3 ββ people-block/default β 460 β 3 ββ form/request-demo-form β 47 β 3 ββ resources/resources β 31 β 3 ββ testimonial/testimonial-simple β 120 β 2 ββ animated-content/default β 48 β 2 ββ header/default β 2 β 1 ββ @wpmedia/video-player-block/video-player β 19 β 1 ββ flip-card/default β 17 β 1 ββ link-list/default β 8 β 1 ββ @wpmedia/htmlbox-block/htmlbox β 2 β 1 βββββββββββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββββββ€β 35 rows 3 columns βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Show all content source usage analytics
sh all-content-sources-usage.sh
This script lists all content sources, from both global content source configurations (from resolvers) and feature configurations. This script does not have CSV export option.
Example output of this script
\--- Global content sources in resolvers ---
βββββββββββββββββββββββββββ¬ββββββββββββββββββββ contentSourceId β countOfResolvers ββ varchar β int64 ββββββββββββββββββββββββββββΌβββββββββββββββββββ€β content-api β 1 ββ content-api-unpublished β 1 ββββββββββββββββββββββββββββ΄βββββββββββββββββββ
--- Content sources in feature configuration is pages and templates ---
βββββββββββββββ¬βββββββββββββββββ¬βββββββββββββββββββ¬ββββββββββββββββββββββββββββββββ featureName β contentService β countOfTimesUsed β countOfPagesOrTemplatesUsing ββ varchar β varchar β int64 β int64 ββββββββββββββββ΄βββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββββββ€β 0 rows βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Show all page URLs
sh all-page-urls.sh
This script lists all published pages with their URIs.
Example output of this script
\--- All published pages: ---
βββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ pageOrTemplateId β uri β name ββ varchar β varchar β varchar ββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€β phcICmmeIveOZsd6t β /products/experience-platform/ β Products: Arc XP Experience Platform ββ pBXYkVlwdCALYjn8t β /solutions/business-leaders/ β Solutions Users: Arc XP for Business Leaders ββ p4Ecmu5dLCPY08t β /solutions/developers/ β Solutions Users: Arc XP for Developers ββ p9NRAEBz90bytDMt β /events/ β Resources: Arc XP Events ββ pn84hmL02c1dpfOt β /tei-confirmation/ β TEI Confirmation Page ββ pxiGuDGazCDjEmXft β /error/404/ β 404 ββ Β· β Β· β Β· ββ Β· β Β· β Β· ββ p57YpfHF8pUc4yXbt β /resources/newsroom/ β Newsroom ββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€β 63 rows (40 shown) 3 columns βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Find pages using a particular feature
sh find-pages-by-feature-name.sh -n global/awesome-feature
This script requires the -n
parameter with a feature name that prints a list of pages and templates that use this feature.
Example output of this script
\--- All published pages using feature: form/contact-form ---
βββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββββββββββββββ pageOrTemplateId β isPageOrTemplate β uri β name β defaultOutputType β published ββ varchar β varchar β varchar β varchar β varchar β varchar ββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ€β phGu0qpUuEMvKTv7t β Page β /products/digital-subscriptions/ β Products: Arc XP Subscriptions β default β vx5WXpbvcMvKTv7t ββ pTYzUa8GeRgyZe6t β Page β /solutions/content-creators/ β Solutions Users: Arc XP for Content Creators β default β vZbqUeoLaRgyZe6t ββ Β· β Β· β Β· β Β· β Β· β Β· ββ Β· β Β· β Β· β Β· β Β· β Β· ββ pxUtJlhzkvjl6ud6t β Page β /solutions/b2c-commerce/ β Solutions Type: Arc XP for B2C Commerce β default β vxMZbAiMBljl6ud6t ββββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββ€β 48 rows (40 shown) 6 columns βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
You can open PageBuilder Editor with the following URL template with the page or template ID in the query string:
https://YOURORG.arcpublishing.com/pagebuilder/editor/curate?p=PAGEID
Find or filter pages by its URI
sh find-pages-by-uri.sh -u /events/
This script lists all pages with the URI containing the provided filter.
Example output of this script
\--- All published pages with URI contains: /events/ ---
βββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββββββββββββββ pageOrTemplateId β isPageOrTemplate β uri β name β defaultOutputType β published ββ varchar β varchar β varchar β varchar β varchar β varchar ββββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ€β p9NRAEBz90bytDMt β Page β /events/ β Resources: Arc XP Events β default β vZYzKx38ly0bytDMt ββ pZYzk79LjKcdNN3u β Page β /events/connect-2024-confirmation/ β Events: Connect 2024 Confirmation Page β default β vfNjUAhVTwKcdNN3u ββ pyVs5fLodScsuEMt β Page β /events/event-template/ β Events: Event Landing Page Template β default β ββ pS0giIIu11awjUTt β Page β /events/state-of-the-content-industry-webinar-12-2023/ β Event: State of the Content Industry Webinar - December 2023 β default β vRQS1A18jl1awjUTt ββ pUCqUspA84rQNWMt β Page β /events/ona-conference/ β Events: Conference ONA example β default β ββ pL2mssR6szJLFGS2u β Page β /events/trust-adoption-ai-newsroom/ β Event: Building trust and adoption of AI in the newsroom (Semji & Mather Economics) β default β vvWys3fv2JLFGS2u ββββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββ
Describe a page or templateβs contents
sh describe-page-or-template.sh -i p123456
This script describes contents of a page or template by its ID provided by the -i
argument. This script shows metadata of this page (URI, title), list of features, sorted by how many times theyβre used in the page or template, and the content sources configured from features.
Example output of this script
\--- Page or Temoplate: #p9NRAEBz90bytDMt ---
ββββββββββββββββββββ¬βββββββββββββββββββ¬βββββββββββ¬βββββββββββββββββββββββββββ¬ββββββββββββββββββββ¬βββββββββββββββββββββ pageOrTemplateId β isPageOrTemplate β uri β name β defaultOutputType β published ββ varchar β varchar β varchar β varchar β varchar β varchar βββββββββββββββββββββΌβββββββββββββββββββΌβββββββββββΌβββββββββββββββββββββββββββΌββββββββββββββββββββΌββββββββββββββββββββ€β p9NRAEBz90bytDMt β Page β /events/ β Resources: Arc XP Events β default β vZYzKx38ly0bytDMt βββββββββββββββββββββ΄βββββββββββββββββββ΄βββββββββββ΄βββββββββββββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββββ
--- All features used in: #p9NRAEBz90bytDMt ---
βββββββββββββββββββββββββββββββββββββββ¬ββββββββββββββββββββ featureName β countOfTimesUsed ββ varchar β int64 ββββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββ€β hero/default β 15 ββ resources/resources-v2 β 15 ββ form/contact-form β 15 ββ alternating-image/alternating-image β 13 ββ form/contact-us-handler β 11 ββ resources/latestResources β 2 ββββββββββββββββββββββββββββββββββββββββ΄βββββββββββββββββββ
--- Content sources used in: #p9NRAEBz90bytDMt ---
βββββββββββββββ¬βββββββββββββββββ¬ββββββββββββββββββββ featureName β contentService β countOfTimesUsed ββ varchar β varchar β int64 ββββββββββββββββ΄βββββββββββββββββ΄βββββββββββββββββββ€β 0 rows ββββββββββββββββββββββββββββββββββββββββββββββββββββ
CSV exports instead of table view printed in command line
Most scripts accept the -c
parameter that prints a CSV file of the same output you see in table views. You can pipe or save the CSV output to a file.
Updates
- Aug 29, 2024: A fix has been published that addresses an issue where some features (at the top level of the curation layout) not being included in the
all-features-usage.sh
script. To update, please pull code from master branch to your local working copy, then runsh _prepare.sh
to re-create your local views.