| @@ -53,8 +53,16 @@ | ||
| 53 | 53 | // writes — silently disappear from the page. |
| 54 | 54 | require_once plugin_dir_path(dirname(__FILE__)) . 'admin/class-metasync-seo-sync-settings.php'; |
| 55 | 55 | |
| 56 | 56 | $sections = array( |
| 57 | + 'analytics' => array( | |
| 58 | + 'title' => 'Usage Data & Product Improvement', | |
| 59 | + 'description' => 'Choose whether to share limited usage data to help improve MetaSync', | |
| 60 | + 'icon' => 'chart-bar', | |
| 61 | + 'priority' => 70, | |
| 62 | + 'default_open' => false, | |
| 63 | + 'render_callback' => array($this, 'render_analytics_section'), | |
| 64 | + ), | |
| 57 | 65 | 'connection' => array( |
| 58 | 66 | 'title' => 'Connection & Authentication', |
| 59 | 67 | 'description' => 'Manage your API connection and authentication settings', |
| 60 | 68 | 'icon' => 'admin-network', |
| @@ -75,11 +83,8 @@ | ||
| 75 | 83 | 'otto_pixel_uuid', |
| 76 | 84 | 'otto_disable_on_loggedin', |
| 77 | 85 | 'otto_disable_preview_button', |
| 78 | 86 | 'seo_priority', |
| 79 | - 'otto_wp_rocket_compat', | |
| 80 | - 'otto_sg_optimizer_compat', | |
| 81 | - 'bookingpress_session_compat', | |
| 82 | 87 | ) |
| 83 | 88 | ), |
| 84 | 89 | 'edge_cache' => array( |
| 85 | 90 | 'title' => 'Edge Cache / CDN', |
| @@ -340,9 +345,8 @@ | ||
| 340 | 345 | </h4> |
| 341 | 346 | <p style="color: var(--dashboard-text-secondary); margin: 0 0 12px 0;">This action will permanently delete:</p> |
| 342 | 347 | <ul style="color: var(--dashboard-text-secondary); margin: 0 0 12px 20px; line-height: 1.8;"> |
| 343 | 348 | <li>All API keys and authentication tokens</li> |
| 344 | - <li>White label branding settings</li> | |
| 345 | 349 | <li>Plugin configuration and preferences</li> |
| 346 | 350 | <li>Instant indexing settings</li> |
| 347 | 351 | <li>Media optimization settings and cache</li> |
| 348 | 352 | <li>Code minification settings</li> |
| @@ -347,9 +351,9 @@ | ||
| 347 | 351 | <li>Media optimization settings and cache</li> |
| 348 | 352 | <li>Code minification settings</li> |
| 349 | 353 | <li>All cached data and crawl information</li> |
| 350 | 354 | </ul> |
| 351 | - <p style="color: var(--dashboard-warning, #f59e0b); margin: 0; font-weight: 600;">You will need to reconfigure the plugin completely after this reset.</p> | |
| 355 | + <p style="color: var(--dashboard-warning, #f59e0b); margin: 0; font-weight: 600;">You will need to reconfigure the plugin's operational settings after this reset.</p> | |
| 352 | 356 | </div> |
| 353 | 357 | <form method="post" action="" onsubmit="return confirmClearSettings(event)"> |
| 354 | 358 | <?php wp_nonce_field('metasync_clear_all_settings_nonce', 'clear_all_settings_nonce'); ?> |
| 355 | 359 | <input type="hidden" name="clear_all_settings" value="yes" /> |
| @@ -389,9 +393,9 @@ | ||
| 389 | 393 | if (!firstConfirm) { |
| 390 | 394 | return false; |
| 391 | 395 | } |
| 392 | 396 | |
| 393 | - var secondConfirm = confirm("🚨 FINAL WARNING 🚨\n\nThis will delete:\n• All API keys and authentication tokens\n• White label branding settings\n• Plugin configuration and preferences\n• Instant indexing settings\n• Media optimization settings and cache\n• Code minification settings\n• All cached data\n\nYou will need to reconfigure the entire plugin from scratch.\n\nType 'DELETE' in the next prompt to confirm."); | |
| 397 | + var secondConfirm = confirm("🚨 FINAL WARNING 🚨\n\nThis will delete:\n• All API keys and authentication tokens\n• Plugin configuration and preferences\n• Instant indexing settings\n• Media optimization settings and cache\n• Code minification settings\n• All cached data\n\nYou will need to reconfigure the plugin's operational settings from scratch.\n\nType 'DELETE' in the next prompt to confirm."); | |
| 394 | 398 | if (!secondConfirm) { |
| 395 | 399 | return false; |
| 396 | 400 | } |
| 397 | 401 | |
| @@ -1130,9 +1134,9 @@ | ||
| 1130 | 1134 | 'apikey' => sprintf('Auto-generated authentication token used for secure API communication between your WordPress site and %s services. You can refresh this token if needed for security purposes.', $plugin_name), |
| 1131 | 1135 | 'otto_pixel_uuid' => sprintf('Your unique %s tracking pixel identifier. This UUID is used to track %s modifications and analytics on your website pages.', $otto_name, $otto_name), |
| 1132 | 1136 | 'otto_disable_on_loggedin' => sprintf('Disable %s modifications when you are logged in to WordPress. This allows you to see and edit the original content without %s\'s enhancements during editing sessions.', $otto_name, $otto_name), |
| 1133 | 1137 | 'otto_disable_preview_button' => sprintf('Hide the %s frontend toolbar that displays the status indicator, preview button, and debug button. Enable this for a cleaner frontend experience.', $otto_name), |
| 1134 | - 'seo_priority' => sprintf('Choose which value appears first on a page when both your custom SEO value and an approved %s suggestion are available. This changes what visitors see; it does not delete or overwrite saved values.', $otto_name), | |
| 1138 | + 'seo_priority' => sprintf('Choose which value appears first on a page when both your custom SEO value (title, description or focus keyword, edited on the post/page screen) and an approved %s suggestion are available. This changes what visitors see; it does not delete or overwrite saved values.', $otto_name), | |
| 1135 | 1139 | 'otto_wp_rocket_compat' => sprintf('WP Rocket Compatibility Mode: Controls how %s interacts with WP Rocket. "Auto" (recommended) allows both to work together by avoiding DONOTCACHEPAGE constant unless necessary for Brizy pages or SG Optimizer conflicts. This ensures WP Rocket\'s JavaScript delay and optimization features continue working.', $otto_name), |
| 1136 | 1140 | 'otto_sg_optimizer_compat' => sprintf('SiteGround Optimizer Compatibility Mode: Controls how %s renders on SiteGround hosting. "Auto" (recommended) uses the internal HTTP fetch, which protects themes that defer inline CSS to the footer (e.g. Divi). "Buffer Mode" renders in-process with no internal fetch — faster on sites whose pages can never be host-cached, for example when a plugin starts a PHP session on every request (BookingPress sessions are removed automatically, so this does not apply to them).', $otto_name), |
| 1137 | 1141 | 'bookingpress_session_compat' => 'BookingPress Session Compatibility: Controls whether MetaSync removes the PHP session BookingPress starts on every public page, so hosts such as SiteGround can page-cache the site again.', |
| 1138 | 1142 | 'otto_disable_for_bots' => sprintf('Enable bot detection to automatically skip %s processing for search engine crawlers, SEO tools, and other bots. This reduces unnecessary API calls and improves performance.', $otto_name), |
| @@ -1163,8 +1167,35 @@ | ||
| 1163 | 1167 | 'twitter_image_alt' => 'Adds descriptive alt text to the image shown when your page is shared on X/Twitter, improving accessibility for screen-reader users. Uses your saved alt text or the image\'s own alt attribute.' |
| 1164 | 1168 | ); |
| 1165 | 1169 | } |
| 1166 | 1170 | |
| 1171 | + public function render_analytics_section() { | |
| 1172 | + $enabled = get_option('metasync_analytics_opt_in', 'no') === 'yes'; | |
| 1173 | + $plugin_name = Metasync::get_effective_plugin_name(); | |
| 1174 | + /* translators: %s: Plugin name. */ | |
| 1175 | + $heading = sprintf(__('Help improve %s', 'metasync'), $plugin_name); | |
| 1176 | + /* translators: %s: Plugin name. */ | |
| 1177 | + $intro = sprintf(__('Allow %s to collect limited usage analytics. This helps us understand which features are used, improve the product, and identify problems.', 'metasync'), $plugin_name); | |
| 1178 | + /* translators: %s: Plugin name. */ | |
| 1179 | + $toggle_label = sprintf(__('Share usage data with %s', 'metasync'), $plugin_name); | |
| 1180 | + ?> | |
| 1181 | + <div class="metasync-analytics-consent-card"> | |
| 1182 | + <div class="metasync-analytics-consent-copy"> | |
| 1183 | + <h3><?php echo esc_html($heading); ?></h3> | |
| 1184 | + <p><?php echo esc_html($intro); ?></p> | |
| 1185 | + <p class="description"><?php esc_html_e('We collect limited technical information such as your site URL, plugin version, WordPress and PHP versions, user role, and feature usage. We do not collect passwords, API keys, customer content, names, or email addresses.', 'metasync'); ?></p> | |
| 1186 | + </div> | |
| 1187 | + <label class="metasync-consent-switch" for="metasync_analytics_opt_in"> | |
| 1188 | + <input type="hidden" name="metasync_analytics_opt_in" value="no" /> | |
| 1189 | + <input type="checkbox" id="metasync_analytics_opt_in" name="metasync_analytics_opt_in" value="yes" <?php checked($enabled); ?> /> | |
| 1190 | + <span class="metasync-consent-slider" aria-hidden="true"></span> | |
| 1191 | + <span class="screen-reader-text"><?php echo esc_html($toggle_label); ?></span> | |
| 1192 | + </label> | |
| 1193 | + <span class="metasync-consent-status" aria-live="polite" data-enabled-label="<?php esc_attr_e('Enabled', 'metasync'); ?>" data-disabled-label="<?php esc_attr_e('Off', 'metasync'); ?>"><?php echo $enabled ? esc_html__('Enabled', 'metasync') : esc_html__('Off', 'metasync'); ?></span> | |
| 1194 | + </div> | |
| 1195 | + <?php | |
| 1196 | + } | |
| 1197 | + | |
| 1167 | 1198 | public function get_field_section($field_id) { |
| 1168 | 1199 | $sections = $this->get_accordion_sections_config(); |
| 1169 | 1200 | |
| 1170 | 1201 | foreach ($sections as $section_key => $section_data) { |
| @@ -1539,8 +1570,11 @@ | ||
| 1539 | 1570 | } |
| 1540 | 1571 | printf('</p>'); |
| 1541 | 1572 | |
| 1542 | 1573 | printf('</div>'); |
| 1574 | + | |
| 1575 | + // The OTTO Pixel UUID is shown once, by the read-only Settings-API | |
| 1576 | + // field in the OTTO Server-Side Rendering section; do not repeat it here. | |
| 1543 | 1577 | |
| 1544 | 1578 | if( isset(Metasync::get_option('general')['searchatlas_api_key'])&&Metasync::get_option('general')['searchatlas_api_key']!=''){ |
| 1545 | 1579 | $timestamp = @Metasync::get_option('general')['send_auth_token_timestamp']; |
| 1546 | 1580 | printf( |