Home › Link Building › Link Strategy
Advanced ⏱ 22 min

Vector Interlinking with Screaming Frog

Instead of guessing which pages should link to which, use embeddings and cosine similarity to compute internal link relevance at scale via Screaming Frog and a Google Apps Script.

What you'll learn

  • Understand the vector-based approach to auditing and planning internal links
  • Learn the 4-sheet spreadsheet system that powers the calculation
  • Know how donor→acceptor relevance is averaged and interpreted
  • Apply this method to a real internal-linking audit

Why Vector-Based Interlinking

Manually judging whether a link between two pages makes topical sense doesn't scale past a few dozen URLs. This method uses OpenAI embeddings plus cosine similarity, computed inside Google Sheets via Apps Script, to score the relevance of every existing or planned internal link objectively and at scale.

The 4-Sheet System

SheetPurpose
Page EmbeddingsEach page's content converted to a vector (via generateEmbedding)
Link EmbeddingsAnchor text + surrounding context for each existing link, vectorized
Query EmbeddingsTarget queries/topics for each page, vectorized
Similarity AnalysisComputed cosine similarity between donor and acceptor pages/links

Core Functions in the Script

The Apps Script includes helper functions for the full pipeline: convertStringToFloatArrayAsJson and parseJsonSafe handle serialization; generateEmbedding calls the OpenAI API for a given text; cosineSimilarity / cosineSimilarityFromJson compute the similarity score; averageJsonEmbeddings and weightedAverageEmbeddings combine multiple embeddings (e.g., averaging a page's multiple query embeddings into one representative vector); vectorNorm supports the underlying math.

⚠ Never expose your API key

generateEmbedding calls the OpenAI API and requires a key. Store it in Apps Script's Script Properties (Project Settings → Script Properties), never hardcoded in the script body or shared in documentation — a key committed to a shared sheet or doc is a live credential leak.

Interpreting the Output

A worked example: averaging donor→acceptor relevance scores yields a combined score around 0.64 for a moderately-related pair — worth a link, but with clearly on-topic anchor text and surrounding context rather than a forced insertion. Scores near the SILO-inclusion thresholds from the Cosine Similarity lesson (0.75+ strong, 0.65-0.75 moderate, below 0.65 weak) apply the same way here.

Turning Scores Into an Internal Linking Ticket

Use the Similarity Analysis sheet to find high-relevance donor→acceptor pairs that currently have no link, and low-relevance existing links that may be diluting topical focus (a TopicalDrift-relevant finding — see that lesson's point about link context mattering as much as presence). Turn each into a specific, named ticket rather than a general "improve interlinking" instruction.

Key Takeaways

  • Vector-based interlinking scores every potential donor→acceptor link objectively via embeddings + cosine similarity
  • The system uses 4 Sheets: Page Embeddings, Link Embeddings, Query Embeddings, and Similarity Analysis
  • Core script functions cover embedding generation, JSON serialization, cosine similarity, and weighted averaging
  • Never hardcode an OpenAI API key in the script — store it in Apps Script Script Properties
  • Use the same relevance thresholds as SILO inclusion: 0.75+ strong, 0.65-0.75 moderate, below 0.65 weak

✅ Action Checklist