Install
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.zipSite 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
- Download or clone this repository
- Upload the
site-analytics-dashboardfolder to/wp-content/plugins/ - 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
- Go to WordPress Admin → Plugins
- Find "Site Analytics Dashboard" in the list
- Click "Activate"
The plugin will automatically create the necessary database tables.
Configuration
1. Set Up Google API Credentials
A. Create a Google Cloud Project:
- Go to Google Cloud Console
- Create a new project or select an existing one
- In the left sidebar, go to "APIs & Services" → "Library"
- Enable the following APIs:
- Google Analytics Data API
- Google Analytics Admin API
- (Future: Google Search Console API)
B. Create OAuth 2.0 Credentials:
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "OAuth client ID"
- Choose "Web application"
- Add name: "Site Analytics Dashboard"
- Add Authorized redirect URI:
https://your-dashboard-site.com/wp-admin/admin.php?page=sad-settingsReplace with your actual WordPress admin URL
- Click "Create"
- Download the JSON credentials file
C. Configure Plugin:
- Go to WordPress Admin → Analytics Dashboard → Settings
- Click the "Google API" tab
- Paste the entire contents of your credentials JSON file into the textarea
- Click "Save Credentials"
- Click "Connect to Google Analytics"
- Authorize the application in the Google OAuth consent screen
- You'll be redirected back to WordPress - connection complete!
2. Add Your Sites
- Go to Analytics Dashboard → Sites
- Click "Add New"
- 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
- Site ID: Unique identifier (e.g.,
- 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
- Go to Analytics Dashboard → Dashboard
- Use the filters to select a site and date range
- Click "Apply" to refresh the data
- Charts update automatically
Managing Sites
- Go to Analytics Dashboard → Sites
- View list of all configured sites
- Click "Edit" to modify a site
- 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 configurationswp_sad_analytics- Analytics data from GA4wp_sad_broken_links- Broken link recordswp_sad_accessibility- Accessibility issueswp_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:
- Go to Analytics Dashboard → Diagnostics
- Check the "System Status" table for any red ✗ marks
- 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:
- Go to Google Cloud Console → Credentials
- Click on your OAuth Client ID
- Under "Authorized redirect URIs", make sure one entry exactly matches the URI shown in the plugin's Settings page (there's a "Copy" button)
- Click Save
- Wait 5 minutes for Google's changes to propagate
- Try connecting again
No Data Showing
- Check that you're connected to Google Analytics (Settings → Google API)
- Verify your GA4 Property ID is correct
- Make sure your site has the GA4 tracking code installed
- Click "Fetch Latest Data" to manually trigger collection
- 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