GSC Insights
Extract actionable insights from GSC data including trends, intents, and opportunities.
get_date_ranges_for_comparison
def get_date_ranges_for_comparison(
days:int=30, # Number of days per period
)->tuple:
Return two consecutive date ranges for period comparison, accounting for 3-day GSC delay.
apply_strftime
def apply_strftime(
date:datetime
):
Call self as a function.
compare_periods
def compare_periods(
recent:list, # Recent period query data
previous:list, # Previous period query data
)->list:
Compare two periods of query data and return trend analysis sorted by impression change.
detect_query_trends
def detect_query_trends(
session:Session, # Active database session
site_url:str, # GSC property URL
page_path:str | None=None, # Filter by page path substring
days:int=30, # Days per comparison period
limit:int=100, # Max queries to analyze
)->list:
Detect rising and declining queries by comparing two consecutive periods.
classify_intent
def classify_intent(
query:str, # Search query
)->str:
Classify query intent based on keyword patterns.
classify_page_intents
def classify_page_intents(
session:Session, # Active database session
site_url:str, # GSC property URL
start_date:str, # Start date (YYYY-MM-DD)
end_date:str, # End date (YYYY-MM-DD)
country:str | None=None, # Filter by country code
page_path:str | None=None, # Filter by page path substring
limit:int=10, # Max rows to return
)->list:
Get top queries with intent classification.
query_words_in_content
def query_words_in_content(
query:str, # Search query
content:str, # Page content
)->bool:
Check if all significant words from a query appear in the content.
find_missing_queries
def find_missing_queries(
queries:list, # GSC query dicts
content:str, # Page content
)->list:
Find GSC queries whose significant words don’t appear in the page content.
find_green_keywords
def find_green_keywords(
session:Session, # Active database session
site_url:str, # GSC property URL
page_path:str, # Page path to analyze
content:str, # Page content
days:int=30, # Days per comparison period
limit:int=100, # Max queries to analyze
)->list:
Find emerging queries not yet covered in page content.