You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Key metric tiles in the PDF are not clickable E.g. Most popular content by pageviews or Top performing keywords - All of the tiles should behave the same as they do on the dashboard. When clicked the user should be either directed to Analytics, Search Console, AdSense, etc.
KM-PDF.mp4
Steps to reproduce
Set up Site Kit with Analytics and AdSense.
Generate the PDF on the menu.
Observe the current behaviour where you cannot click on any of the data.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Each ranked row in a Key Metrics table tile in the PDF opens the same destination its dashboard row opens.
Page rows open the Analytics "All pages and screens" report filtered to that page, over the export's date range.
"Top performing keywords" rows open the Search Console search analytics report for an exact match on that keyword.
"Top earning content" rows open the Analytics report for that page.
Rows in a view-only export render as plain text with no link.
Key Metrics tiles whose dashboard rows are not links stay unlinked in the PDF.
Implementation Brief
In assets/js/components/pdf-export/shared-react-pdf-components/PDFMetricTileTable.tsx:
Add an optional primaryURL to PDFMetricTileTableRow.
Render the primary cell through PDFLink with href={ row.primaryURL }, keeping truncateContent on the text.
Remove the linked prop and the primaryLink style: PDFLink applies CONTENT_SECONDARY to a linked row and renders plain PDFTypography when href is empty.
In assets/js/components/KeyMetrics/key-metrics-pdf-tiles.js:
Add viewOnly to the getTileData parameters and pass it to each tile's extractor.
Set primaryURL on each row of KM_ANALYTICS_POPULAR_CONTENT, KM_ANALYTICS_POPULAR_PRODUCTS, KM_ANALYTICS_MOST_ENGAGING_PAGES, KM_ANALYTICS_LEAST_ENGAGING_PAGES, KM_ANALYTICS_TOP_RECENT_TRENDING_PAGES, KM_ANALYTICS_TOP_RETURNING_VISITOR_PAGES, KM_ANALYTICS_TOP_PAGES_DRIVING_LEADS and KM_ANALYTICS_ADSENSE_TOP_EARNING_CONTENT with getAllPagesReportURL( registry.select( MODULES_ANALYTICS_4 ), pagePath, pdfTableDates( dates ) ) from assets/js/modules/analytics-4/utils/page-report-url.ts, keyed by the row's page path rather than its title.
Set primaryURL on KM_SEARCH_CONSOLE_POPULAR_KEYWORDS rows with registry.select( MODULES_SEARCH_CONSOLE ).getServiceReportURL( { ...generateDateRangeArgs( pdfTableDates( dates ) ), query: !${ keyword } } ), the exclamation mark forcing an exact match as PopularKeywordsWidget does.
Return an empty primaryURL for every row when viewOnly is true.
Drop linked: true from all nine tile configs.
In assets/js/components/KeyMetrics/getPDFData.ts:
Destructure viewOnly from the loader parameters and pass it to getTileData alongside registry, dates and signal.
Extend the tile config type so getTileData accepts viewOnly.
Bug Description
The Key metric tiles in the PDF are not clickable E.g.
Most popular content by pageviewsorTop performing keywords- All of the tiles should behave the same as they do on the dashboard. When clicked the user should be either directed to Analytics, Search Console, AdSense, etc.KM-PDF.mp4
Steps to reproduce
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation Brief
assets/js/components/pdf-export/shared-react-pdf-components/PDFMetricTileTable.tsx:primaryURLtoPDFMetricTileTableRow.PDFLinkwithhref={ row.primaryURL }, keepingtruncateContenton the text.linkedprop and theprimaryLinkstyle:PDFLinkappliesCONTENT_SECONDARYto a linked row and renders plainPDFTypographywhenhrefis empty.assets/js/components/KeyMetrics/key-metrics-pdf-tiles.js:viewOnlyto thegetTileDataparameters and pass it to each tile's extractor.primaryURLon each row ofKM_ANALYTICS_POPULAR_CONTENT,KM_ANALYTICS_POPULAR_PRODUCTS,KM_ANALYTICS_MOST_ENGAGING_PAGES,KM_ANALYTICS_LEAST_ENGAGING_PAGES,KM_ANALYTICS_TOP_RECENT_TRENDING_PAGES,KM_ANALYTICS_TOP_RETURNING_VISITOR_PAGES,KM_ANALYTICS_TOP_PAGES_DRIVING_LEADSandKM_ANALYTICS_ADSENSE_TOP_EARNING_CONTENTwithgetAllPagesReportURL( registry.select( MODULES_ANALYTICS_4 ), pagePath, pdfTableDates( dates ) )fromassets/js/modules/analytics-4/utils/page-report-url.ts, keyed by the row's page path rather than its title.primaryURLonKM_SEARCH_CONSOLE_POPULAR_KEYWORDSrows withregistry.select( MODULES_SEARCH_CONSOLE ).getServiceReportURL( { ...generateDateRangeArgs( pdfTableDates( dates ) ), query:!${ keyword }} ), the exclamation mark forcing an exact match asPopularKeywordsWidgetdoes.primaryURLfor every row whenviewOnlyis true.linked: truefrom all nine tile configs.assets/js/components/KeyMetrics/getPDFData.ts:viewOnlyfrom the loader parameters and pass it togetTileDataalongsideregistry,datesandsignal.getTileDataacceptsviewOnly.Test Coverage
assets/js/components/pdf-export/shared-react-pdf-components/PDFMetricTileTable.test.tsx:primaryURLrenders its label as a link to that URLassets/js/components/KeyMetrics/key-metrics-pdf-tiles.test.js:viewOnlyis trueassets/js/components/KeyMetrics/getPDFData.test.ts:viewOnlyreachesgetTileDataQA Brief
Changelog entry