PluginProbe
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO / 2.14.2
ThinkRank AI SEO – AI SEO Plugin for WordPress: Schema, XML Sitemaps, Meta Tags, Search Console & Local SEO v2.14.2
2.14.2 2.14.1 2.14.0 2.13.0 2.12.0 2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.1.0 2.0.2 2.0.1 2.0.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 All 57 releases
← All changes | includes/integrations/class-google-search-console-client.php +16 -2 2.13.0 → 2.14.2 View file →
@@ -101,10 +101,15 @@
101 101 // Check if the site is already verified by listing sites
102 102 $sites = $this->list_sites();
103 103 $site_verified = false;
104 104
105 + // A domain property is compared in its punycode form, so an IDN
106 + // matches whichever form the account lists it in.
107 + $wanted = \ThinkRank\Core\Url_Validator::search_console_domain_property($site_url) ?? $site_url;
108 +
105 109 foreach ($sites['siteEntry'] ?? [] as $site) {
106 - if ($site['siteUrl'] === $site_url) {
110 + $listed = (string) ($site['siteUrl'] ?? '');
111 + if ($listed === $site_url || (\ThinkRank\Core\Url_Validator::search_console_domain_property($listed) ?? $listed) === $wanted) {
107 112 $site_verified = true;
108 113 break;
109 114 }
110 115 }
@@ -248,12 +253,15 @@
248 253 * @param string $site_url Site URL to get data for
249 254 * @param string $start_date Start date (Y-m-d)
250 255 * @param string $end_date End date (Y-m-d)
251 256 * @param int $row_limit Maximum rows to return
257 + * @param array $dimensions Dimensions to group by
258 + * @param array $filters Optional dimension filters (ANDed), each
259 + * {dimension, operator, expression}. @since 2.15.0
252 260 * @return array Raw rows from GSC API
253 261 * @throws \Exception If API request fails
254 262 */
255 - public function get_search_performance_by_dates(string $site_url, string $start_date, string $end_date, int $row_limit = 500, array $dimensions = ['query']): array {
263 + public function get_search_performance_by_dates(string $site_url, string $start_date, string $end_date, int $row_limit = 500, array $dimensions = ['query'], array $filters = []): array {
256 264 $endpoint = '/sites/' . rawurlencode($site_url) . '/searchAnalytics/query';
257 265
258 266 $request_body = [
259 267 'startDate' => $start_date,
@@ -264,8 +272,14 @@
264 272 // data — matches what the Search Console web UI displays, so the
265 273 // last 2-4 days aren't missing.
266 274 'dataState' => 'all',
267 275 ];
276 +
277 + // Optional dimension filters, ANDed, e.g. one page's queries:
278 + // [['dimension' => 'page', 'operator' => 'equals', 'expression' => $url]].
279 + if (!empty($filters)) {
280 + $request_body['dimensionFilterGroups'] = [['filters' => array_values($filters)]];
281 + }
268 282
269 283 $full_url = self::API_BASE_URL . $endpoint;
270 284 $response = $this->make_request($full_url, $request_body, 'POST');
271 285