| 1 |
<?php |
| 2 |
/** |
| 3 |
* SEO Analytics Settings Configuration |
| 4 |
* |
| 5 |
* Default settings configuration for SEO Analytics & Intelligence system |
| 6 |
* including Google API integration, AI insights, monitoring, and reporting. |
| 7 |
* |
| 8 |
* @package ThinkRank |
| 9 |
* @subpackage Config |
| 10 |
* @since 1.0.0 |
| 11 |
*/ |
| 12 |
|
| 13 |
declare(strict_types=1); |
| 14 |
|
| 15 |
// Prevent direct access |
| 16 |
if (!defined('ABSPATH')) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
/** |
| 21 |
* Get default SEO Analytics settings |
| 22 |
* Following ThinkRank settings configuration patterns |
| 23 |
* |
| 24 |
* @return array Default settings array |
| 25 |
*/ |
| 26 |
function get_default_seo_analytics_settings(): array { |
| 27 |
return [ |
| 28 |
// Core Analytics Settings |
| 29 |
'enabled' => false, |
| 30 |
'setup_completed' => false, |
| 31 |
|
| 32 |
// Google Analytics Configuration |
| 33 |
'google_analytics_property_id' => '', |
| 34 |
|
| 35 |
// Search Console Configuration |
| 36 |
'search_console_property' => '', |
| 37 |
|
| 38 |
// AI Features |
| 39 |
'enable_ai_insights' => true, |
| 40 |
'enable_automated_alerts' => false, |
| 41 |
'enable_predictive_analysis' => false, |
| 42 |
|
| 43 |
// Monitoring Configuration |
| 44 |
'monitoring_frequency' => 3600, // 1 hour in seconds |
| 45 |
'alert_thresholds' => [ |
| 46 |
'traffic_drop_percentage' => 20, |
| 47 |
'ranking_drop_positions' => 5, |
| 48 |
'core_web_vitals_threshold' => 'needs_improvement' |
| 49 |
], |
| 50 |
'report_schedule' => 'weekly', // daily, weekly, monthly |
| 51 |
|
| 52 |
// Data Management |
| 53 |
'data_retention_days' => 90, |
| 54 |
'cache_analytics_data' => true, |
| 55 |
|
| 56 |
// Dashboard Configuration |
| 57 |
'dashboard_widgets' => [ |
| 58 |
'traffic_overview', |
| 59 |
'search_performance', |
| 60 |
'core_web_vitals', |
| 61 |
'seo_opportunities', |
| 62 |
'keyword_rankings' |
| 63 |
], |
| 64 |
|
| 65 |
// Notification Settings |
| 66 |
'email_notifications' => false, |
| 67 |
'notification_email' => '', |
| 68 |
'slack_webhook_url' => '', |
| 69 |
|
| 70 |
// Advanced Settings |
| 71 |
'enable_debug_mode' => false, |
| 72 |
'api_rate_limiting' => true, |
| 73 |
'parallel_requests' => false, |
| 74 |
|
| 75 |
// Feature Flags |
| 76 |
'enable_competitor_analysis' => false, |
| 77 |
'enable_content_suggestions' => true, |
| 78 |
'enable_technical_seo_monitoring' => true |
| 79 |
]; |
| 80 |
} |
| 81 |
|
| 82 |
/** |
| 83 |
* Get SEO Analytics settings validation rules |
| 84 |
* Following ThinkRank validation patterns |
| 85 |
* |
| 86 |
* @return array Validation rules |
| 87 |
*/ |
| 88 |
function get_seo_analytics_validation_rules(): array { |
| 89 |
return [ |
| 90 |
'enabled' => [ |
| 91 |
'type' => 'boolean', |
| 92 |
'required' => false, |
| 93 |
'default' => false |
| 94 |
], |
| 95 |
'setup_completed' => [ |
| 96 |
'type' => 'boolean', |
| 97 |
'required' => false, |
| 98 |
'default' => false |
| 99 |
], |
| 100 |
'google_analytics_property_id' => [ |
| 101 |
'type' => 'string', |
| 102 |
'required' => false, |
| 103 |
'pattern' => '/^properties\/\d+$/', |
| 104 |
'description' => 'GA4 Property ID in format: properties/123456789' |
| 105 |
], |
| 106 |
'search_console_property' => [ |
| 107 |
'type' => 'string', |
| 108 |
'required' => false, |
| 109 |
'format' => 'url', |
| 110 |
'description' => 'Verified site URL in Search Console' |
| 111 |
], |
| 112 |
'enable_ai_insights' => [ |
| 113 |
'type' => 'boolean', |
| 114 |
'required' => false, |
| 115 |
'default' => true |
| 116 |
], |
| 117 |
'enable_automated_alerts' => [ |
| 118 |
'type' => 'boolean', |
| 119 |
'required' => false, |
| 120 |
'default' => false |
| 121 |
], |
| 122 |
'enable_predictive_analysis' => [ |
| 123 |
'type' => 'boolean', |
| 124 |
'required' => false, |
| 125 |
'default' => false |
| 126 |
], |
| 127 |
'monitoring_frequency' => [ |
| 128 |
'type' => 'integer', |
| 129 |
'required' => false, |
| 130 |
'minimum' => 300, // 5 minutes minimum |
| 131 |
'maximum' => 86400, // 24 hours maximum |
| 132 |
'default' => 3600 |
| 133 |
], |
| 134 |
'alert_thresholds' => [ |
| 135 |
'type' => 'object', |
| 136 |
'required' => false, |
| 137 |
'properties' => [ |
| 138 |
'traffic_drop_percentage' => [ |
| 139 |
'type' => 'integer', |
| 140 |
'minimum' => 5, |
| 141 |
'maximum' => 50 |
| 142 |
], |
| 143 |
'ranking_drop_positions' => [ |
| 144 |
'type' => 'integer', |
| 145 |
'minimum' => 1, |
| 146 |
'maximum' => 20 |
| 147 |
], |
| 148 |
'core_web_vitals_threshold' => [ |
| 149 |
'type' => 'string', |
| 150 |
'enum' => ['good', 'needs_improvement', 'poor'] |
| 151 |
] |
| 152 |
] |
| 153 |
], |
| 154 |
'report_schedule' => [ |
| 155 |
'type' => 'string', |
| 156 |
'required' => false, |
| 157 |
'enum' => ['daily', 'weekly', 'monthly'], |
| 158 |
'default' => 'weekly' |
| 159 |
], |
| 160 |
'data_retention_days' => [ |
| 161 |
'type' => 'integer', |
| 162 |
'required' => false, |
| 163 |
'minimum' => 30, |
| 164 |
'maximum' => 365, |
| 165 |
'default' => 90 |
| 166 |
], |
| 167 |
'cache_analytics_data' => [ |
| 168 |
'type' => 'boolean', |
| 169 |
'required' => false, |
| 170 |
'default' => true |
| 171 |
], |
| 172 |
'dashboard_widgets' => [ |
| 173 |
'type' => 'array', |
| 174 |
'required' => false, |
| 175 |
'items' => [ |
| 176 |
'type' => 'string', |
| 177 |
'enum' => [ |
| 178 |
'traffic_overview', |
| 179 |
'search_performance', |
| 180 |
'core_web_vitals', |
| 181 |
'seo_opportunities', |
| 182 |
'keyword_rankings', |
| 183 |
'competitor_analysis', |
| 184 |
'content_suggestions' |
| 185 |
] |
| 186 |
] |
| 187 |
], |
| 188 |
'email_notifications' => [ |
| 189 |
'type' => 'boolean', |
| 190 |
'required' => false, |
| 191 |
'default' => false |
| 192 |
], |
| 193 |
'notification_email' => [ |
| 194 |
'type' => 'string', |
| 195 |
'required' => false, |
| 196 |
'format' => 'email' |
| 197 |
], |
| 198 |
'slack_webhook_url' => [ |
| 199 |
'type' => 'string', |
| 200 |
'required' => false, |
| 201 |
'format' => 'url' |
| 202 |
], |
| 203 |
'enable_debug_mode' => [ |
| 204 |
'type' => 'boolean', |
| 205 |
'required' => false, |
| 206 |
'default' => false |
| 207 |
], |
| 208 |
'api_rate_limiting' => [ |
| 209 |
'type' => 'boolean', |
| 210 |
'required' => false, |
| 211 |
'default' => true |
| 212 |
], |
| 213 |
'parallel_requests' => [ |
| 214 |
'type' => 'boolean', |
| 215 |
'required' => false, |
| 216 |
'default' => false |
| 217 |
], |
| 218 |
'enable_competitor_analysis' => [ |
| 219 |
'type' => 'boolean', |
| 220 |
'required' => false, |
| 221 |
'default' => false |
| 222 |
], |
| 223 |
'enable_content_suggestions' => [ |
| 224 |
'type' => 'boolean', |
| 225 |
'required' => false, |
| 226 |
'default' => true |
| 227 |
], |
| 228 |
'enable_technical_seo_monitoring' => [ |
| 229 |
'type' => 'boolean', |
| 230 |
'required' => false, |
| 231 |
'default' => true |
| 232 |
] |
| 233 |
]; |
| 234 |
} |
| 235 |
|
| 236 |
/** |
| 237 |
* Get SEO Analytics feature descriptions |
| 238 |
* For UI help text and documentation |
| 239 |
* |
| 240 |
* @return array Feature descriptions |
| 241 |
*/ |
| 242 |
function get_seo_analytics_feature_descriptions(): array { |
| 243 |
return [ |
| 244 |
'ai_insights' => 'AI-powered analysis of your SEO performance with actionable recommendations', |
| 245 |
'automated_alerts' => 'Automatic notifications when significant changes are detected', |
| 246 |
'predictive_analysis' => 'Forecast potential SEO impact of content and technical changes', |
| 247 |
'competitor_analysis' => 'Track and compare your performance against competitors', |
| 248 |
'content_suggestions' => 'AI-generated content optimization suggestions', |
| 249 |
'technical_seo_monitoring' => 'Monitor Core Web Vitals and technical SEO factors' |
| 250 |
]; |
| 251 |
} |
| 252 |
|
| 253 |
/** |
| 254 |
* Get SEO Analytics setup requirements |
| 255 |
* For setup wizard and validation |
| 256 |
* |
| 257 |
* @return array Setup requirements |
| 258 |
*/ |
| 259 |
function get_seo_analytics_setup_requirements(): array { |
| 260 |
return [ |
| 261 |
'required_apis' => [ |
| 262 |
'google_analytics' => [ |
| 263 |
'name' => 'Google Analytics Data API', |
| 264 |
'required' => true, |
| 265 |
'description' => 'Required for traffic and user behavior data' |
| 266 |
], |
| 267 |
'search_console' => [ |
| 268 |
'name' => 'Google Search Console API', |
| 269 |
'required' => true, |
| 270 |
'description' => 'Required for search performance and indexing data' |
| 271 |
], |
| 272 |
'pagespeed' => [ |
| 273 |
'name' => 'Google PageSpeed Insights API', |
| 274 |
'required' => false, |
| 275 |
'description' => 'Optional for Core Web Vitals monitoring' |
| 276 |
] |
| 277 |
], |
| 278 |
'minimum_requirements' => [ |
| 279 |
'wordpress_version' => '6.0', |
| 280 |
'php_version' => '8.0', |
| 281 |
'memory_limit' => '256M', |
| 282 |
'curl_support' => true |
| 283 |
] |
| 284 |
]; |
| 285 |
} |
| 286 |
|