Support Log in

23. Google Search Console Integration

Developer Guide
Prefer video? Watch the Rank Forge tutorials 9 short guides covering every feature Watch

GSC integration provides keyword rank tracking, content decay detection, and daily sync via cron. PRO feature. Scheduled GSC sync re-checks RANKFORGE_License::instance()->can( 'gsc' ) before it calls remote APIs. Renewing the license resumes sync using the existing connection data.

OAuth Flow

  1. The administrator clicks Connect Google; get_auth_url() returns an address of our API, api.avakode.com/integrations/google/auth
  2. The administrator approves the access on the consent screen of Google
  3. Rank Forge then reads Search Console data through our API; see the Privacy Policy, sections 3.3 and 3.9

Fetching Rankings

php
$gsc = RANKFORGE_GSC::instance();

if ( ! $gsc->is_connected() ) {
    return;
}

// Get keyword rankings for the last 28 days
$rankings = $gsc->get_keyword_rankings( 28, 100 );
// Returns: [ [ 'keyword' => '...', 'clicks' => 150, 'impressions' => 5200, 'ctr' => 2.9, 'position' => 8.3 ], ... ]

// Get rankings for a specific page URL
$page_rankings = $gsc->get_page_rankings( 'https://example.com/my-post/', 28 );

Content Decay Detection

Compares the last 28 days vs the previous 28 days to find pages losing traffic:

php
$decay = $gsc->detect_content_decay();
// Returns: [ [ 'url' => '...', 'post_id' => 42, 'clicks_now' => 15, 'clicks_prev' => 50,
//   'click_change' => -70, 'position_now' => 12.5, 'position_prev' => 5.2 ], ... ]
Decay criteria: clicks dropped >30% OR position worsened by >3 spots.

Cron Sync

A daily cron event rankforge_daily_gsc_sync refreshes cached rankings and decay data:

php
$rankings = get_option( 'rankforge_gsc_rankings_cache', [] );
$decay    = get_option( 'rankforge_gsc_decay_cache', [] );
$last     = get_option( 'rankforge_gsc_last_sync', 0 );

// Disconnect GSC
RANKFORGE_GSC::instance()->disconnect();

—

Forge AI Assistant Online

Hi! I'm the Rank Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs