WP Manifestindependent plugin directory
manifest / analytics / ttc-site-analytics-dashboard

TTC Site Analytics Dashboard

Centralized dashboard for monitoring TTC sites - analytics, 404s, broken links, and 508 compliance

★ 0stars

Install

Download source zip No release zip yet

This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.

Install straight from GitHub with WP-CLI:

wp plugin install https://github.com/drafthorsestudio/ttc-site-analytics-dashboard/archive/refs/heads/main.zip
No built-in updater. New versions won't appear under Dashboard → Updates. Install new releases yourself, or let Git Updater track the repository.

Site Analytics Dashboard - WordPress Plugin

A centralized WordPress plugin for monitoring multiple sites with Google Analytics 4, 404 tracking, broken link detection, and 508 accessibility compliance scanning.

Features

Phase 1 (Currently Implemented)

  • ✅ Google Analytics 4 Integration - OAuth authentication and data fetching
  • ✅ Multi-site Management - Configure and monitor multiple websites
  • ✅ Analytics Dashboard - Visual charts and summary cards
  • ✅ 404 Error Tracking - Track 404 errors from GA4
  • ✅ Automated Data Collection - Scheduled cron jobs for daily data fetching
  • ✅ Custom Database Tables - Store historical analytics data

Phase 2 (Coming Soon)

  • ⏳ Google Search Console Integration
  • ⏳ Broken Link Checker
  • ⏳ Crawl error detection

Phase 3 (Planned)

  • ⏳ 508/WCAG Accessibility Scanner
  • ⏳ Accessibility issue tracking and reporting

Phase 4 (Planned)

  • ⏳ Export reports to PDF/CSV
  • ⏳ Email notifications for critical issues
  • ⏳ Advanced filtering and search

Requirements

  • WordPress 5.8 or higher
  • PHP 7.4 or higher
  • MySQL 5.7 or higher
  • Composer (for installing dependencies)
  • Google Cloud Console account (for API credentials)

Installation

Step 1: Upload Plugin

  1. Download or clone this repository
  2. Upload the site-analytics-dashboard folder to /wp-content/plugins/
  3. Or zip the folder and upload via WordPress admin

Step 2: Install Dependencies

The plugin requires the Google API Client library. Install it via Composer:

cd wp-content/plugins/site-analytics-dashboard
composer install

If you don't have Composer installed, download it from https://getcomposer.org/

Step 3: Activate Plugin

  1. Go to WordPress Admin → Plugins
  2. Find "Site Analytics Dashboard" in the list
  3. Click "Activate"

The plugin will automatically create the necessary database tables.

Configuration

1. Set Up Google API Credentials

A. Create a Google Cloud Project:

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. In the left sidebar, go to "APIs & Services" → "Library"
  4. Enable the following APIs:
    • Google Analytics Data API
    • Google Analytics Admin API
    • (Future: Google Search Console API)

B. Create OAuth 2.0 Credentials:

  1. Go to "APIs & Services" → "Credentials"
  2. Click "Create Credentials" → "OAuth client ID"
  3. Choose "Web application"
  4. Add name: "Site Analytics Dashboard"
  5. Add Authorized redirect URI:
    https://your-dashboard-site.com/wp-admin/admin.php?page=sad-settings

    Replace with your actual WordPress admin URL

  6. Click "Create"
  7. Download the JSON credentials file

C. Configure Plugin:

  1. Go to WordPress Admin → Analytics Dashboard → Settings
  2. Click the "Google API" tab
  3. Paste the entire contents of your credentials JSON file into the textarea
  4. Click "Save Credentials"
  5. Click "Connect to Google Analytics"
  6. Authorize the application in the Google OAuth consent screen
  7. You'll be redirected back to WordPress - connection complete!

2. Add Your Sites

  1. Go to Analytics Dashboard → Sites
  2. Click "Add New"
  3. Fill in the form:
    • Site ID: Unique identifier (e.g., site1, mywebsite)
    • Site Name: Display name (e.g., "Main Website")
    • Site URL: Full URL (e.g., https://example.com)
    • GA4 Property ID: Select from dropdown (if connected) or enter manually
    • Search Console URL: (Optional) Your property URL from Search Console
    • Scan Frequency: Daily or Weekly
    • Status: Check "Active" to include in monitoring
  4. Click "Add Site"

To find your GA4 Property ID:

  • If connected: It will appear in the dropdown
  • Manual: Go to Google Analytics → Admin → Property Settings
  • The Property ID is a numeric value (e.g., 123456789)

3. Configure Cron Jobs (Optional but Recommended)

By default, the plugin uses WordPress's wp_cron, which requires site traffic to trigger. For more reliable scheduling, set up a server cron job:

# Add to your crontab (crontab -e)
# Run every hour at 2 minutes past
2 * * * * wget -q -O - https://your-site.com/wp-cron.php?doing_wp_cron >/dev/null 2>&1

Or disable wp_cron and use real cron:

// Add to wp-config.php
define('DISABLE_WP_CRON', true);

Usage

Dashboard

The main dashboard shows:

  • Summary Cards: Total sessions, users, pageviews, and 404 errors
  • Charts: Visual representation of trends over time
  • Sites Overview: Status of all configured sites

Filters:

  • Select individual site or view all sites
  • Choose date range (7, 30, or 90 days)

Fetch Latest Data:

  • Click "Fetch Latest Data" to manually trigger data collection
  • Useful for immediate updates or testing

Viewing Analytics

  1. Go to Analytics Dashboard → Dashboard
  2. Use the filters to select a site and date range
  3. Click "Apply" to refresh the data
  4. Charts update automatically

Managing Sites

  1. Go to Analytics Dashboard → Sites
  2. View list of all configured sites
  3. Click "Edit" to modify a site
  4. Click "Delete" to remove a site (this will also delete historical data)

Scheduled Tasks

The plugin automatically runs these tasks:

  • Daily at 2:00 AM: Fetch analytics data from GA4
  • Weekly (Mondays at 3:00 AM): Check for broken links
  • Weekly (Wednesdays at 3:00 AM): Run accessibility scans

You can view the last run time on the Dashboard.

Database Tables

The plugin creates the following custom tables:

  • wp_sad_sites - Site configurations
  • wp_sad_analytics - Analytics data from GA4
  • wp_sad_broken_links - Broken link records
  • wp_sad_accessibility - Accessibility issues
  • wp_sad_search_console - Search Console data

Troubleshooting

"Google API Client library not found"

Run composer install in the plugin directory to install dependencies.

"Blank page" or "White screen" after pasting credentials

This usually means there's an issue with the JSON format or credential type. Use the new Diagnostics page:

  1. Go to Analytics Dashboard → Diagnostics
  2. Check the "System Status" table for any red ✗ marks
  3. Look at "OAuth Credentials Details" to verify your setup

Common causes:

  • Wrong credential type: You need "OAuth Client ID (Web application)", not Service Account or API Key
  • Invalid JSON: Make sure you copied the ENTIRE contents of the JSON file
  • Missing redirect URI: The redirect URI in Google Console must match exactly

OAuth Error: "redirect_uri_mismatch"

Make sure the redirect URI in your Google Cloud Console credentials exactly matches your WordPress admin URL.

Expected URI format:

https://your-dashboard-site.com/wp-admin/admin.php?page=sad-settings

Check for:

  • http vs https
  • www vs non-www
  • Trailing slashes
  • Port numbers (if using non-standard ports)

How to fix:

  1. Go to Google Cloud Console → Credentials
  2. Click on your OAuth Client ID
  3. Under "Authorized redirect URIs", make sure one entry exactly matches the URI shown in the plugin's Settings page (there's a "Copy" button)
  4. Click Save
  5. Wait 5 minutes for Google's changes to propagate
  6. Try connecting again

No Data Showing

  1. Check that you're connected to Google Analytics (Settings → Google API)
  2. Verify your GA4 Property ID is correct
  3. Make sure your site has the GA4 tracking code installed
  4. Click "Fetch Latest Data" to manually trigger collection
  5. Check that cron jobs are running (Settings → last fetch time)

Permission Issues

Make sure the Google account you're using has access to the GA4 properties you want to monitor.

Security

  • All Google API credentials are stored encrypted in WordPress options
  • OAuth tokens are automatically refreshed when expired
  • All AJAX requests require admin capabilities and nonce verification
  • User inputs are sanitized and validated

Support

For issues, questions, or feature requests, please contact your administrator.

Changelog

Version 1.0.0

  • Initial release
  • Google Analytics 4 integration
  • Multi-site management
  • Visual dashboard with charts
  • Automated data collection
  • 404 error tracking

Future Roadmap

  • Phase 2: Search Console integration and link checking
  • Phase 3: Accessibility scanning
  • Phase 4: Advanced reporting and notifications
  • Integration with more analytics platforms
  • Custom alert thresholds
  • Team collaboration features

Credits

Built using:

  • Google APIs PHP Client
  • Chart.js for visualizations
  • WordPress REST API
  • Custom database architecture

License

GPL v2 or later