Browse Source

Analytics: card layout, flat page report with /til subpages

- Restyle the Analytics page to match the other card pages: .container.leader with a
  white title above a #dadada #content card on the dark body (box-shadow:none kills
  the legacy article.single shadow), map moved inside the card, transparent
  list-group rows.
- Content column: Matomo flat=1 so /til subpages (tracked via docusaurus-plugin-
  matomo on the same idSite=1) list as individual pages instead of one 'til' folder;
  links point at davidwindham.com; the bare '/' homepage row shows '/index' so it's
  clickable. Bump both Recent Visitors and Content filter_limit to 50.
windhamdavid 2 weeks ago
parent
commit
d892d2771b
4 changed files with 37 additions and 21 deletions
  1. 8 5
      inc/analytics.php
  2. 13 13
      page-analytics.php
  3. 16 3
      style.css
  4. 0 0
      v4-style.min.css

+ 8 - 5
inc/analytics.php

@@ -5,7 +5,7 @@ function dw_wik_places() {
 	$url = "https://davidawindham.com/wik/";
 	$url .= "?module=API&method=UserCountry.getCity";
 	$url .= "&idSite=1&period=month&date=yesterday";
-	$url .= "&format=JSON&filter_limit=34";
+	$url .= "&format=JSON&filter_limit=50";
 	$url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
 
 	$fetched = file_get_contents($url);
@@ -30,7 +30,9 @@ function dw_wik_url() {
 	$url = "https://davidawindham.com/wik/";
 	$url .= "?module=API&method=Actions.getPageUrls";
 	$url .= "&idSite=1&period=month&date=yesterday";
-	$url .= "&format=JSON&filter_limit=43";
+	// flat=1 expands the hierarchical folder report into individual page URLs, so the
+	// /til subpages (tracked via docusaurus-plugin-matomo) show instead of one "til" folder.
+	$url .= "&format=JSON&filter_limit=50&flat=1";
 	$url .= "&token_auth=3910b0da85f448ae35d4b75b4e6912bb";
 
 	$fetched = file_get_contents($url);
@@ -41,11 +43,12 @@ function dw_wik_url() {
 	}
 
 	foreach ($content as $row) {
-	  $urls = htmlspecialchars(html_entity_decode(urldecode($row['label']), ENT_QUOTES), ENT_QUOTES);
 		$label = $row['label'];
 		$hits = $row['nb_hits'];
-		$time = $row['avg_time_on_page'];
-	    print("<li class='list-group-item'> <a href='https://davidawindham.com/$label'>$label</a> <span class='badge'> $hits </span></li>");
+		$path = '/' . ltrim( html_entity_decode( urldecode( $label ), ENT_QUOTES ), '/' ); // flat labels start with "/"
+		$disp = htmlspecialchars( $path, ENT_QUOTES );
+		$text = ( '/' === $path ) ? '/index' : $disp; // bare "/" is too small to click
+	    print("<li class='list-group-item'> <a href='https://davidwindham.com$disp'>$text</a> <span class='badge'> $hits </span></li>");
 	}
 
 }

+ 13 - 13
page-analytics.php

@@ -1,16 +1,16 @@
 <?php get_header(); ?>
 
-  <div class="container" role="main">
-    <div style="margin:80px 0 -110px;">
-      <iframe id="map" width="100%" height="600px" scrolling="yes" frameborder="0"  src="https://davidawindham.com/wik/index.php?module=Widgetize&action=iframe&disableLink=0&widget=1&moduleToWidgetize=UserCountryMap&actionToWidgetize=visitorMap&idSite=1&period=range&date=last30&disableLink=1&widget=1&token_auth=6785f36a6cacb01306dbd8d58a4207aa"></iframe>
-    </div>
-		<article  id="content" class="single" >
-			<div class="row">
-				<div class="col-sm-12">
-					<h1 style="font-size:28px;font-family:CM Sans;">Analytics</h1>
-					<p>I just put this page together as a simple way to monitor and share traffic on this website. These are lists of the content and visitors from the last month.</p>
-					</div>
+	<div class="container leader" role="main">
+		<div class="row">
+			<div class="col-md-12">
+				<h1 class="cm-sans fs-2 analytics-heading animate__animated animate__fadeInLeft">Analytics</h1>
+			</div>
+		</div>
+		<article id="content" class="single">
+			<div class="analytics-map">
+				<iframe id="map" width="100%" height="600px" scrolling="yes" frameborder="0" src="https://davidawindham.com/wik/index.php?module=Widgetize&action=iframe&disableLink=0&widget=1&moduleToWidgetize=UserCountryMap&actionToWidgetize=visitorMap&idSite=1&period=range&date=last30&disableLink=1&widget=1&token_auth=6785f36a6cacb01306dbd8d58a4207aa"></iframe>
 			</div>
+			<p>Visitors and content from the last month capped at 50.</p>
 			<div class="row">
 				<div class="col-sm-6">
 					<h4>Recent Visitors</h4>
@@ -20,9 +20,9 @@
 				</div>
 				<div class="col-sm-6">
 					<h4>Content</h4>
-          <ul class="list-group">
-					  <?php echo dw_wik_url()?>
-          </ul>
+					<ul class="list-group">
+						<?php echo dw_wik_url()?>
+					</ul>
 				</div>
 			</div>
 		</article>

+ 16 - 3
style.css

@@ -1297,7 +1297,8 @@ body.desk .entry-content {
 body.music .container.leader,
 body.archive .container.leader,
 body.contact .container.leader,
-body.sitemap .container.leader {
+body.sitemap .container.leader,
+body.analytics .container.leader {
 	width: auto;
 	max-width: 1280px;
 }
@@ -1316,7 +1317,8 @@ body.archive article#content {
 .music-heading,
 .archive-heading,
 .contact-heading,
-.sitemap-heading {
+.sitemap-heading,
+.analytics-heading {
 	color: #fff;
 	font-size: 28px;
 }
@@ -1342,13 +1344,23 @@ body.archive .entry-content {
 /* Contact page โ€” #content itself is the card (no inner .entry-content wrapper).
    Override the legacy single-article 100px top margin so the card sits under the title. */
 body.contact #content,
-body.sitemap #content {
+body.sitemap #content,
+body.analytics #content {
 	background: #dadada;
+	box-shadow: none; /* neutralize the legacy article.single drop-shadow */
 	padding: 96px;
 	border-radius: 6px;
 	margin-top: 1.25rem;
 	margin-bottom: 3rem;
 }
+/* Analytics list rows sit on the #dadada card โ€” drop the default grey list-group
+   background so they read as clean rows on the card. */
+body.analytics .list-group-item {
+	background: transparent;
+}
+.analytics-map {
+	margin: 1rem 0 2rem;
+}
 /* Search + 404 โ€” block templates get the same dark body + white title-above +
    #dadada card as the classic archive/contact/sitemap pages. (Only single posts
    keep the title inside the card.) */
@@ -1821,6 +1833,7 @@ h2.entry-title {
 	body.archive .entry-content,
 	body.contact #content,
 	body.sitemap #content,
+	body.analytics #content,
 	.wp-block-group.entry-content {
 		padding: 1.5rem;
 	}

File diff suppressed because it is too large
+ 0 - 0
v4-style.min.css


Some files were not shown because too many files changed in this diff