Problem/Motivation
One feature that was requested would be to add a new setting to Piwik PRO module dashboard where existing pages could be added.
These pages would then appear in the dashboard in a separate block/segment and their stats would be always displayed (They would be pinned).
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | Screenshot 2026-02-27 at 11.54.51.png | 94.74 KB | immoreel |
| #5 | Screenshot 2026-02-27 at 11.55.22.png | 34.45 KB | immoreel |
Issue fork piwik_pro-3575167
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
immoreel commentedThis patch adds the "Pinned Pages" feature to the Piwik PRO Dashboard.
Important: This patch is based on the branch from issue #3560912 (Dashboard overhaul)
and should be applied on top of that branch, or merged after #3560912 is committed.
Features
- Pin pages from node edit form: A "Piwik PRO" section appears in the sidebar
of node edit pages with a "Pin to dashboard" checkbox
- Pinned Pages widget: Shows a table at the top of the dashboard with statistics
for all pinned pages (Page Views, Visitors, Bounce Rate)
- URL-based matching: Statistics are fetched from Piwik PRO by matching page URLs
Technical changes
- New service: `PinnedPagesManager` for CRUD operations on pinned node IDs
- New API endpoint: `/api/piwik-dashboard/pinned-pages`
- New method: `PiwikApiClient::fetchPinnedPages()` with URL filtering
- Config schema updated with `pinned_node_ids` sequence
- Form alter hook adds checkbox to node edit form
- Dashboard template and JS updated with pinned pages widget
Files changed
- `piwik_pro_dashboard.module` - Form alter hooks
- `piwik_pro_dashboard.services.yml` - PinnedPagesManager service
- `piwik_pro_dashboard.routing.yml` - New API route
- `config/schema/piwik_pro_dashboard.schema.yml` - pinned_node_ids field
- `src/Service/PinnedPagesManager.php` - New service (new file)
- `src/Service/PiwikApiClient.php` - fetchPinnedPages method
- `src/Controller/ApiController.php` - getPinnedPages endpoint
- `templates/piwik-dashboard.html.twig` - Pinned pages widget
- `js/dashboard.js` - Fetch and render pinned pages
- `css/dashboard.css` - Table styling
Comment #5
immoreel commentedThe pin to dashboard option in the sidebar.

Table of pinned pages in the dashboard

Comment #6
frazile commentedHey, we merged the overhaul ticket, but we additionally did some refactoring of the code base. Could you take a look at the merge request and check the conflicts?
Comment #7
immoreel commentedI've resolved the merge conflicts and rewrote fetchPinnedPages() to use sendQuery(), also getPinnedPages now uses parseRange() / handleApiRequest() helpers
Comment #8
immoreel commentedComment #9
hartsak commented