
{"id":17554,"date":"2024-05-20T10:55:42","date_gmt":"2024-05-20T14:55:42","guid":{"rendered":"https:\/\/ipullrank.com\/?p=17554"},"modified":"2025-04-26T21:54:35","modified_gmt":"2025-04-27T01:54:35","slug":"cosine-similarity-knn-in-google-sheets","status":"publish","type":"post","link":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets","title":{"rendered":"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"17554\" class=\"elementor elementor-17554\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9851171 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9851171\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-839f2bd\" data-id=\"839f2bd\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c9ae56f elementor-widget elementor-widget-text-editor\" data-id=\"c9ae56f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">As I discussed in <a href=\"https:\/\/ipullrank.com\/vector-embeddings-is-all-you-need\"><span class=\"s1\">my previous post<\/span><\/a>, vector embeddings have become an indispensable tool, allowing us to go beyond keyword-based strategies and use semantic relevance in content analysis. Many technical SEOs don\u2019t code (no judgment) but are spreadsheet wizards, so let\u2019s talk about leveraging Google Sheets for calculating cosine similarity and k-nearest neighbors with your vector embeddings. Whether you\u2019re enhancing your keyword research, looking for gaps, or clustering related content, integrating these techniques into your Google Sheets workflow can provide powerful, data-driven insights that inform improved rankings.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-233ef67 elementor-widget elementor-widget-heading\" data-id=\"233ef67\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Writing User-Defined Functions in Google Sheets<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e4ed9cf elementor-widget elementor-widget-text-editor\" data-id=\"e4ed9cf\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Google Apps Script is a powerful, cloud-based scripting language that enables users to automate tasks and extend the functionality of Google Workspace applications like Sheets, Docs, and Slides. A form of JavaScript, Apps Script allows for seamless integration and customization across these tools, making it an underrated yet invaluable resource for enhancing productivity in the Google Workspace environment.<\/p><p class=\"p1\">Cosine Similarity and kNN are not native functions in Sheets, so we\u2019ll need to prepare our own in Apps Script. Here are steps to set it up:<\/p><ol><li class=\"p1\"><b>Open Google Sheets &#8211;<\/b> Open the Google Sheets document where you want to write your script. In our case, we\u2019ll start from a blank sheet.<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cdaeda4 elementor-widget elementor-widget-image\" data-id=\"cdaeda4\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-1024x550.png\" class=\"attachment-large size-large wp-image-17556\" alt=\"Screenshot of an open Google Sheets spreadsheet\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/open-google-sheets.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f3844ad elementor-widget elementor-widget-text-editor\" data-id=\"f3844ad\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol class=\"ol1\" start=\"2\">\n \t<li class=\"li1\"><b>Access the Apps Script Editor &#8211; <\/b>Click on Extensions &gt; Apps Scrip to open the code editor.<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7bb219e elementor-widget elementor-widget-image\" data-id=\"7bb219e\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-1024x550.png\" class=\"attachment-large size-large wp-image-17555\" alt=\"Screenshot with an arrow showing how to open up the Apps Script Editor in Google Sheets\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/access-apps-script-editor.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cd927ad elementor-widget elementor-widget-text-editor\" data-id=\"cd927ad\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol class=\"ol1\" start=\"3\">\n \t<li class=\"li1\"><b>Create a New Script &#8211;<\/b> In the Apps Script editor, delete any default code in the script file (Code.gs). The default code will look like this when you open it.<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f0c9380 elementor-widget elementor-widget-image\" data-id=\"f0c9380\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-1024x550.png\" class=\"attachment-large size-large wp-image-17557\" alt=\"screenshot of a new Apps Script\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/blank-apple-script.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-6dcc9ec elementor-widget elementor-widget-text-editor\" data-id=\"6dcc9ec\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol class=\"ol1\" start=\"4\">\n \t<li class=\"li1\"><b>Write Your Function &#8211;<\/b> Start by writing your function. For example, let\u2019s write a function to get OpenAI embeddings based on a target cell. This is a good way for us to vectorize keyword data for comparison against page content embeddings collected via Screaming Frog SEO Spider.<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-c623b7e elementor-widget elementor-widget-text-editor\" data-id=\"c623b7e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<pre><code class=\"language-\">function GETEMBEDDINGS(input) {\n\u00a0\u00a0const url = 'https:\/\/api.openai.com\/v1\/embeddings';\n\u00a0\u00a0const apiKey = 'YOUR_OPENAI_KEY';\n\n\u00a0\u00a0\u00a0const payload = {\n\u00a0\u00a0\u00a0\u00a0model: 'text-embedding-3-small',\u00a0\n\u00a0\u00a0\u00a0\u00a0input: input\u00a0\u00a0\n\u00a0\u00a0};\n\n\u00a0\u00a0console.log(\"payload: \" + JSON.stringify(payload));\n\u00a0\u00a0const options = {\n\u00a0\u00a0\u00a0\u00a0method: 'post',\n\u00a0\u00a0\u00a0\u00a0contentType: 'application\/json',\n\u00a0\u00a0\u00a0\u00a0headers: {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0'Authorization': 'Bearer ' + apiKey\n\u00a0\u00a0\u00a0\u00a0},\n\u00a0\u00a0\u00a0\u00a0payload: JSON.stringify(payload),\n\u00a0\u00a0\u00a0\u00a0muteHttpExceptions: true\n\u00a0\u00a0};\n\u00a0\u00a0console.log(\"options:\" + JSON.stringify(options));\n\u00a0\u00a0const response = UrlFetchApp.fetch(url, options);\n\u00a0\u00a0const responseData = JSON.parse(response.getContentText());\n\n\u00a0\u00a0if (responseData.error) {\n\u00a0\u00a0\u00a0\u00a0throw new Error('API Error: ' + responseData.error.message);\n\u00a0\u00a0}\n\n\u00a0\u00a0const embeddings = responseData.data[0].embedding;\n\u00a0\u00a0return JSON.stringify(embeddings);\n}<\/code><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d326c0c elementor-widget elementor-widget-text-editor\" data-id=\"d326c0c\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol start=\"5\">\n \t<li class=\"p1\"><b>Fill in your OpenAI API Key &#8211; <\/b>To generate embeddings, you&#8217;ll need an OpenAI API key. You can <a href=\"https:\/\/help.openai.com\/en\/articles\/4936850-where-do-i-find-my-openai-api-key\"><span class=\"s1\">follow these instructions to get a key<\/span><\/a>.<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-55761cf elementor-widget elementor-widget-image\" data-id=\"55761cf\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-1024x550.png\" class=\"attachment-large size-large wp-image-17561\" alt=\"Screenshot of Apps Script where to paste OpenAI API key\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/apps-script-paste-in-openai-api-key.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a150957 elementor-widget elementor-widget-text-editor\" data-id=\"a150957\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol start=\"6\"><li class=\"p1\"><b>Verify it Works &#8211; <\/b>The GETEMBEDDINGS() function is written to return data, not to print it to the screen, so we\u2019ll set up a test function that passes text and logs it to the console to make sure everything is working.<\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f6ea539 elementor-widget elementor-widget-text-editor\" data-id=\"f6ea539\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<pre><code class=\"language-\">function testEmbeddings()\n{\n  Logger.log(GETEMBEDDINGS(\"I really need to hire iPullRank for SEO.\"))\n}<\/code><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b35e854 elementor-widget elementor-widget-text-editor\" data-id=\"b35e854\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol start=\"7\"><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Save Your Script &#8211;<\/b><span style=\"font-weight: 400;\"> Click the floppy disk icon or press Ctrl + S to save your script. Name your project appropriately.<\/span><span style=\"font-weight: 400;\"><br \/><\/span><\/li><\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b15797c elementor-widget elementor-widget-image\" data-id=\"b15797c\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-1024x550.png\" class=\"attachment-large size-large wp-image-17559\" alt=\"\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/save-your-apps-script.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-fd7f625 elementor-widget elementor-widget-text-editor\" data-id=\"fd7f625\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol start=\"8\">\n \t<li class=\"p1\"><b>Run Your Function &#8211; <\/b>In the Apps Script editor, click the dropdown menu next to the Run button and select your function name. The first time you run the script, you&#8217;ll need to authorize it. Follow the prompts to allow necessary permissions.<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-22ca105 elementor-widget elementor-widget-image\" data-id=\"22ca105\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-1024x550.png\" class=\"attachment-large size-large wp-image-17560\" alt=\"Screenshot of Apps Script where you should run the function\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/run-your-scriptt.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-46ce979 elementor-widget elementor-widget-text-editor\" data-id=\"46ce979\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p>Authorization looks like any other authorization in the Google ecosystem. Don\u2019t be surprised when Apps Script asks for access.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e1a3335 elementor-widget elementor-widget-image\" data-id=\"e1a3335\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"826\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/google-authorization.png\" class=\"attachment-large size-large wp-image-17562\" alt=\"Screenshot of the Google Authorization window\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/google-authorization.png 674w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/google-authorization-245x300.png 245w\" sizes=\"(max-width: 674px) 100vw, 674px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4f4f2ea elementor-widget elementor-widget-text-editor\" data-id=\"4f4f2ea\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<ol class=\"ol1\" start=\"9\">\n \t<li class=\"li1\"><b>Test &#8211; <\/b>Check the Logs under the Executions menu to debug any issues. If you see a series of decimal numbers print to your screen, then things are working.<\/li>\n<\/ol>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-e1d6c9b elementor-widget elementor-widget-image\" data-id=\"e1d6c9b\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"430\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-1024x550.png\" class=\"attachment-large size-large wp-image-17563\" alt=\"screenshot of apps script showing a test of the execution log\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-1024x550.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-300x161.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-768x412.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-1536x825.png 1536w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-825x443.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs-945x507.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/test-and-check-the-execution-logs.png 1920w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-575080e elementor-widget elementor-widget-text-editor\" data-id=\"575080e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">You can now access your script from your Google Sheet as a function using\n<code>=GETEMBEDDINGS\n(cell)<\/code>. Keep in mind that OpenAI embeddings have a 3191 token input limit. I have not implemented any of the chunking and averaging from the other post in this function because our primary use case here is vectorizing keywords.\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5a1df26 elementor-widget elementor-widget-image\" data-id=\"5a1df26\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"662\" height=\"244\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/getembeddings-function-cell.png\" class=\"attachment-large size-large wp-image-17564\" alt=\"screenshot of google sheet getembeddings function cell\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/getembeddings-function-cell.png 662w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/getembeddings-function-cell-300x111.png 300w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5c97979 elementor-widget elementor-widget-text-editor\" data-id=\"5c97979\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Now, let\u2019s walk through the other functions you\u2019ll need to do vector comparisons.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4a950c4 elementor-widget elementor-widget-heading\" data-id=\"4a950c4\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Convert Strings to Floats<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7e05ebd elementor-widget elementor-widget-text-editor\" data-id=\"7e05ebd\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">First things first, we need to convert our string embeddings to float arrays. Embeddings are often stored as <a href=\"https:\/\/en.wikipedia.org\/wiki\/String_(computer_science)\"><span class=\"s1\">strings<\/span><\/a> (text) if you captured them via Screaming Frog, but to perform mathematical operations like cosine similarity, we need to convert these strings into arrays of <a href=\"https:\/\/en.wikipedia.org\/wiki\/Floating-point_arithmetic\"><span class=\"s1\">floats<\/span><\/a> (decimal numbers). This conversion ensures that each vector&#8217;s numerical values can be processed correctly for distance calculations.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5ff4514 elementor-widget elementor-widget-text-editor\" data-id=\"5ff4514\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<pre><code class=\"language-\">function convertStringToFloatArray(str) {\n  return str.replace(\/[\\[\\]]\/g, '') \/\/ Remove brackets\n            .split(',')             \/\/ Split by commas\n            .map(parseFloat);       \/\/ Convert to floats\n}<\/code><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ffbba2f elementor-widget elementor-widget-text-editor\" data-id=\"ffbba2f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Follow the steps above to add the function to your project in Apps Script.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-96e282b elementor-widget elementor-widget-heading\" data-id=\"96e282b\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Cosine Similarity<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-2f20ef1 elementor-widget elementor-widget-text-editor\" data-id=\"2f20ef1\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Next, let&#8217;s define the function to calculate cosine similarity between two vectors. As we <a href=\"https:\/\/ipullrank.com\/content-relevance\"><span class=\"s1\">previously discussed<\/span><\/a>, cosine similarity measures the cosine of the angle between two vectors, providing a metric for how similar they are in terms of direction. This is particularly useful in SEO for understanding the semantic similarity between different pieces of content, or the relevance of content to a given keyword in this example thereby enabling more nuanced keyword analysis and content clustering.<\/p><p class=\"p1\">Here\u2019s the code:<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-59330b5 elementor-widget elementor-widget-text-editor\" data-id=\"59330b5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<pre><code class=\"language-\">function cosineSimilarity(vecA, vecB) {\n  if (vecA.length !== vecB.length) {\n    throw new Error(\"Vectors must be the same length\");\n  }\n  vecA = convertStringToFloatArray(vecA);\n  vecB = convertStringToFloatArray(vecB);\n  const dotProduct = vecA.reduce((sum, a, idx) =&gt; sum + a * vecB[idx], 0);\n  const magnitudeA = Math.sqrt(vecA.reduce((sum, a) =&gt; sum + a * a, 0));\n  const magnitudeB = Math.sqrt(vecB.reduce((sum, b) =&gt; sum + b * b, 0));\n  return dotProduct \/ (magnitudeA * magnitudeB);\n}<\/code><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ce9080b elementor-widget elementor-widget-text-editor\" data-id=\"ce9080b\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Here\u2019s an example of the computed similarity in the spreadsheet. We have our embeddings for our keyword pulled via the <code>=GETEMBEDDINGS()<\/code> function and embeddings for the landing page from our Screaming Frog crawl. Then we run our cosine similarity function by passing both vectors.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-a0a9b40 elementor-widget elementor-widget-image\" data-id=\"a0a9b40\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"753\" height=\"233\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/google-sheets-cosine-similarity.png\" class=\"attachment-large size-large wp-image-17565\" alt=\"\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/google-sheets-cosine-similarity.png 753w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/google-sheets-cosine-similarity-300x93.png 300w\" sizes=\"(max-width: 753px) 100vw, 753px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-33e4d32 elementor-widget elementor-widget-text-editor\" data-id=\"33e4d32\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Follow the steps above to add the cosine similarity function to your project.\u00a0<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4680f4f elementor-widget elementor-widget-heading\" data-id=\"4680f4f\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">K-Nearest Neighbors\n<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-235f2b9 elementor-widget elementor-widget-text-editor\" data-id=\"235f2b9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">Finally, we compute the nearest neighbors using cosine similarity. The k-nearest neighbors (k-NN) algorithm identifies the k vectors that are most similar to a target vector, based on a chosen distance metric like cosine similarity. In SEO, this can help in finding the most semantically similar keywords or content pieces, aiding in content optimization and internal linking.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-55f52c5 elementor-widget elementor-widget-text-editor\" data-id=\"55f52c5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<pre><code class=\"language-\">function computeNearestNeighbors(targetCell, embeddingsColumn, dataColumn, numNeighbors,showScores=0) {\n\u00a0\u00a0const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();\n\n\u00a0\u00a0\/\/ Get target embedding from target cell\n\u00a0\u00a0const targetEmbeddingString = targetCell;\n\u00a0\u00a0const targetEmbedding = convertStringToFloatArray(targetEmbeddingString);\n\n\u00a0\u00a0\/\/ Get embeddings and associated data from specified columns\n\u00a0\u00a0const embeddingsRange = sheet.getRange(`${embeddingsColumn}2:${embeddingsColumn}`).getValues();\n\u00a0\u00a0const dataRange = sheet.getRange(`${dataColumn}2:${dataColumn}`).getValues();\n\n\u00a0\u00a0const embeddingsValues = embeddingsRange.filter(row =&gt; row[0] !== \"\");\n\u00a0\u00a0const dataValues = dataRange.filter(row =&gt; row[0] !== \"\");\n\n\u00a0\u00a0\/\/ Compute distances using cosine similarity\n\u00a0\u00a0const distances = embeddingsValues.map((row, index) =&gt; {\n\u00a0\u00a0\u00a0\u00a0const embedding = convertStringToFloatArray(row[0]);\n\u00a0\u00a0\u00a0\u00a0return {\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0index: index + 2, \/\/ +2 to match row number in sheet (since we start from row 2)\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0distance: cosineSimilarity(targetEmbedding, embedding),\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0data: dataValues[index][0]\n\u00a0\u00a0\u00a0\u00a0};\n\u00a0\u00a0});\n\n\u00a0\u00a0\/\/ Sort by distance\n\u00a0\u00a0distances.sort((a, b) =&gt; b.distance - a.distance); \/\/ Descending order for cosine similarity\n\n\u00a0\u00a0\/\/ Output nearest neighbors\n\u00a0\u00a0const nearestNeighbors = distances.slice(0, numNeighbors);\n\n\u00a0\u00a0var results = nearestNeighbors.map(neighbor =&gt; neighbor.data);\n\n\u00a0\u00a0if (showScores !=0){\n\u00a0\u00a0\u00a0\u00a0results = nearestNeighbors.map(neighbor =&gt; `Data: ${neighbor.data}, Score: ${neighbor.distance.toFixed(4)}`);\n\u00a0\u00a0}\n\n\u00a0\u00a0return results.join(\", \");\n}<\/code><\/pre>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-f2b3ba9 elementor-widget elementor-widget-text-editor\" data-id=\"f2b3ba9\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">This function is a bit more complex to use because you need to provide the lookup embeddings and the list of embeddings and the column you want to pull results from.<\/p>\n\n<ol class=\"ol1\">\n \t<li class=\"li1\"><b>Place the data and set the range &#8211; <\/b>Copy your data whether pulled via Screaming Frog or otherwise. Ensure your embeddings that you want to compare against are in the specified column, starting from row 2.<\/li>\n \t<li class=\"li1\"><b>Function Parameters &#8211; <\/b>Call the <code>computeNearestNeighbors()<\/code> function with the following parameters:\n<ol class=\"ol1\">\n \t<li class=\"li1\"><b>targetCell &#8211;<\/b> The cell containing the embedding you want (e.g., B2).<\/li>\n \t<li class=\"li1\"><b>embeddingsColumn &#8211; <\/b>The column containing the embeddings (e.g.,\u00a0 \u201cK\u201d).<\/li>\n \t<li class=\"li1\"><b>dataColumn &#8211; <\/b>the column containing the data that you want returned based on the match. In our case this will be the URL column. (E.g. \u201cL\u201d)<\/li>\n \t<li class=\"li1\"><b>numNeighbors &#8211;<\/b> The number of nearest neighbors to return (e.g., 5).<\/li>\n \t<li class=\"li1\"><b>showScores &#8211;<\/b> this is an optional flag that returns the cosine similarity scores<\/li>\n<\/ol>\n<\/li>\n \t<li class=\"li1\">Run the Function &#8211; using <code>=computeNearestNeighbors()<\/code> in a cell.<\/li>\n<\/ol>\n<p class=\"p1\">If we want a single match we run the function with numNeighbors set to 1 as follows: <code>=computeNearestNeighbors(B2,\"L\",\"K\",1)<\/code>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0410301 elementor-widget elementor-widget-image\" data-id=\"0410301\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"152\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches-1024x194.png\" class=\"attachment-large size-large wp-image-17566\" alt=\"Screenshot of Google Sheets with k-nearest neighbor top match example\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches-1024x194.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches-300x57.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches-768x145.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches-825x156.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches-945x179.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-matches.png 1185w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-88b8318 elementor-widget elementor-widget-text-editor\" data-id=\"88b8318\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">If we want three matches, we set numNeighbors to 3 like so: <code>=computeNearestNeighbors(B2,\"L\",\"K\",3)<\/code>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-8f164d0 elementor-widget elementor-widget-image\" data-id=\"8f164d0\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"189\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3-1024x242.png\" class=\"attachment-large size-large wp-image-17567\" alt=\"Google Sheets screenshot of k-nearest neighbors top 3 example\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3-1024x242.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3-300x71.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3-768x181.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3-825x195.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3-945x223.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-example-top-3.png 1185w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-7c25dc5 elementor-widget elementor-widget-text-editor\" data-id=\"7c25dc5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">If we want three matches and the scores cosine similarity scores, we use the optional 5th parameter <code>=computeNearestNeighbors(B2,\"L\",\"K\",3,1)<\/code>.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-ba8f072 elementor-widget elementor-widget-image\" data-id=\"ba8f072\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"191\" src=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score-1024x244.png\" class=\"attachment-large size-large wp-image-17568\" alt=\"Screenshot of Google Sheet with top 3 matches of k-nearest neighbor with cosine similarity score\" srcset=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score-1024x244.png 1024w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score-300x71.png 300w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score-768x183.png 768w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score-825x196.png 825w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score-945x225.png 945w, https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/k-nearest-neighbors-top-3-with-cosine-similarity-score.png 1184w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-df28709 elementor-widget elementor-widget-heading\" data-id=\"df28709\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Download our Workbook<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-13e8381 elementor-widget elementor-widget-text-editor\" data-id=\"13e8381\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">If you&#8217;re in a rush and just want to get to the analysis instead of setting everything up, go ahead and download our Google Sheets workbook by filling out this form.<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-9e77ff6 elementor-widget elementor-widget-html\" data-id=\"9e77ff6\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<script charset=\"utf-8\" type=\"text\/javascript\" src=\"\/\/js.hsforms.net\/forms\/embed\/v2.js\"><\/script>\n<script>\n  hbspt.forms.create({\n    region: \"na1\",\n    portalId: \"738796\",\n    formId: \"9b767eab-6711-4b74-b8ae-f616e8511e59\"\n  });\n<\/script>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-74e5bff elementor-widget elementor-widget-heading\" data-id=\"74e5bff\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Sheets Is the Not Ideal Environment<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cc07e47 elementor-widget elementor-widget-text-editor\" data-id=\"cc07e47\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p class=\"p1\">I share these functions in support of SEOs that prefer spreadsheets over code. However, this is far less efficient and far more limited than using Python to do the same. In fact, I don\u2019t know how performant this will be when you start having many rows. As you find more value in using embeddings, I&#8217;d encourage you to learn more about Python or at least use your favorite chatbot to help you write code.\u00a0<\/p><p class=\"p1\">Failing that, when your data gets too big, BigQuery ML has <a href=\"https:\/\/cloud.google.com\/bigquery\/docs\/reference\/standard-sql\/bigqueryml-syntax-generate-embedding\"><span class=\"s1\">embedding<\/span><\/a> and <a href=\"https:\/\/cloud.google.com\/bigquery\/docs\/reference\/standard-sql\/bigqueryml-syntax-distance\"><span class=\"s1\">distance functions<\/span><\/a> that integrate with VertexAI directly.\u00a0<\/p><p class=\"p1\">Happy semantic optimizing!<\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-4348221 elementor-widget elementor-widget-template\" data-id=\"4348221\" data-element_type=\"widget\" data-widget_type=\"template.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-template\">\n\t\t\t\t\t<div data-elementor-type=\"section\" data-elementor-id=\"17351\" class=\"elementor elementor-17351\" data-elementor-post-type=\"elementor_library\">\n\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-51a09b09 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"51a09b09\" data-element_type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-2238df9f\" data-id=\"2238df9f\" data-element_type=\"column\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-7fba21b9 elementor-widget elementor-widget-heading\" data-id=\"7fba21b9\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">Next Steps<\/h2>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d80b72f elementor-widget elementor-widget-text-editor\" data-id=\"d80b72f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t<p><span style=\"font-weight: 400;\">Here are three ways iPullRank can help you combine SEO and content to earn visibility for your business and drive revenue:<\/span><\/p><ol><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Schedule a 30-Minute Strategy Session: <\/b><span style=\"font-weight: 400;\">Share your biggest SEO and content challenges so we can put together a custom discovery deck after looking through your digital presence. No one-size-fits-all solutions, only tailored advice to grow your business.<\/span><a href=\"https:\/\/ipullrank.com\/contact\"><span style=\"font-weight: 400;\"> Schedule your consultation session now<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/li><li aria-level=\"1\"><strong>Get Our Newsletter:<\/strong> AI is reshaping search. The Rank Report gives you signal through the noise, so your brand doesn\u2019t just keep up, it leads. <a href=\"https:\/\/ipullrank.com\/rank-report\">Subscribe to the Rank Report.<\/a><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Enhance Your Content&#8217;s Relevance with Relevance Doctor:<\/b><span style=\"font-weight: 400;\"> Not sure if your content is mathematically relevant? Use Relevance Doctor to test and improve your content&#8217;s relevancy, ensuring it ranks for your targeted keywords.<\/span><a href=\"https:\/\/ipullrank.com\/tools\/relevance-doctor\"><span style=\"font-weight: 400;\"> Test your content relevance today<\/span><\/a><span style=\"font-weight: 400;\">.<\/span><\/li><\/ol><p><span style=\"font-weight: 400;\">Want more? Visit <\/span><a href=\"https:\/\/ipullrank.com\/blog\">our blog<\/a> <span style=\"font-weight: 400;\">for access to past webinars, exclusive guides, and insightful blogs crafted by our team of experts.\u00a0<\/span><\/p>\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>As I discussed in my previous post, vector embeddings have become an indispensable tool, allowing us to go beyond keyword-based strategies and use semantic relevance in content analysis. Many technical SEOs don\u2019t code (no judgment) but are spreadsheet wizards, so let\u2019s talk about leveraging Google Sheets for calculating cosine similarity and k-nearest neighbors with your [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":18452,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":true,"content-type":"","footnotes":""},"categories":[26],"tags":[],"diagnosis-deliverable":[],"class_list":["post-17554","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-seo"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets - iPullRank<\/title>\n<meta name=\"description\" content=\"Use this Google Sheets Apps Script to find k-Nearest Neighbors across your site with a highly relevant cosine similarity score.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets - iPullRank\" \/>\n<meta property=\"og:description\" content=\"Use this Google Sheets Apps Script to find k-Nearest Neighbors across your site with a highly relevant cosine similarity score.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\" \/>\n<meta property=\"og:site_name\" content=\"iPullRank\" \/>\n<meta property=\"article:published_time\" content=\"2024-05-20T14:55:42+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-27T01:54:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"699\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Mike King\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ipullrankagency\" \/>\n<meta name=\"twitter:site\" content=\"@ipullrankagency\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mike King\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#article\",\"isPartOf\":{\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\"},\"author\":{\"name\":\"Mike King\",\"@id\":\"https:\/\/ipullrank.com\/#\/schema\/person\/82831a4b9f4b8be81d5a9bfed4cb9b20\"},\"headline\":\"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets\",\"datePublished\":\"2024-05-20T14:55:42+00:00\",\"dateModified\":\"2025-04-27T01:54:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\"},\"wordCount\":1176,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/ipullrank.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png\",\"articleSection\":[\"SEO\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\",\"url\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\",\"name\":\"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets - iPullRank\",\"isPartOf\":{\"@id\":\"https:\/\/ipullrank.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage\"},\"image\":{\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage\"},\"thumbnailUrl\":\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png\",\"datePublished\":\"2024-05-20T14:55:42+00:00\",\"dateModified\":\"2025-04-27T01:54:35+00:00\",\"description\":\"Use this Google Sheets Apps Script to find k-Nearest Neighbors across your site with a highly relevant cosine similarity score.\",\"breadcrumb\":{\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage\",\"url\":\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png\",\"contentUrl\":\"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png\",\"width\":699,\"height\":400},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ipullrank.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ipullrank.com\/#website\",\"url\":\"https:\/\/ipullrank.com\/\",\"name\":\"iPullRank\",\"description\":\"Digital Marketing Agency in NYC\",\"publisher\":{\"@id\":\"https:\/\/ipullrank.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ipullrank.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ipullrank.com\/#organization\",\"name\":\"iPullRank\",\"url\":\"https:\/\/ipullrank.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ipullrank.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ipullrank.com\/wp-content\/uploads\/2025\/03\/Logo_-_Layers.svg\",\"contentUrl\":\"https:\/\/ipullrank.com\/wp-content\/uploads\/2025\/03\/Logo_-_Layers.svg\",\"width\":177,\"height\":36,\"caption\":\"iPullRank\"},\"image\":{\"@id\":\"https:\/\/ipullrank.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/ipullrankagency\",\"https:\/\/www.linkedin.com\/company\/ipullrank\/\",\"https:\/\/www.youtube.com\/@iPullRankSEO\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ipullrank.com\/#\/schema\/person\/82831a4b9f4b8be81d5a9bfed4cb9b20\",\"name\":\"Mike King\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ipullrank.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d57e62b40de6db99771f85cbce3ab1d29071b8cd0d643c8dcf2fc55818e1769f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d57e62b40de6db99771f85cbce3ab1d29071b8cd0d643c8dcf2fc55818e1769f?s=96&d=mm&r=g\",\"caption\":\"Mike King\"},\"description\":\"Mike King is the Founder and CEO of iPullRank. Deeply technical and highly creative, Mike has helped generate over $4B in revenue for his clients. A rapper and recovering big agency guy, Mike's greatest clients are his two daughters: Zora and Glory.\",\"url\":\"https:\/\/ipullrank.com\/author\/ipullrank\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets - iPullRank","description":"Use this Google Sheets Apps Script to find k-Nearest Neighbors across your site with a highly relevant cosine similarity score.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets","og_locale":"en_US","og_type":"article","og_title":"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets - iPullRank","og_description":"Use this Google Sheets Apps Script to find k-Nearest Neighbors across your site with a highly relevant cosine similarity score.","og_url":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets","og_site_name":"iPullRank","article_published_time":"2024-05-20T14:55:42+00:00","article_modified_time":"2025-04-27T01:54:35+00:00","og_image":[{"width":699,"height":400,"url":"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png","type":"image\/png"}],"author":"Mike King","twitter_card":"summary_large_image","twitter_creator":"@ipullrankagency","twitter_site":"@ipullrankagency","twitter_misc":{"Written by":"Mike King","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#article","isPartOf":{"@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets"},"author":{"name":"Mike King","@id":"https:\/\/ipullrank.com\/#\/schema\/person\/82831a4b9f4b8be81d5a9bfed4cb9b20"},"headline":"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets","datePublished":"2024-05-20T14:55:42+00:00","dateModified":"2025-04-27T01:54:35+00:00","mainEntityOfPage":{"@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets"},"wordCount":1176,"commentCount":0,"publisher":{"@id":"https:\/\/ipullrank.com\/#organization"},"image":{"@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage"},"thumbnailUrl":"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png","articleSection":["SEO"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets","url":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets","name":"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets - iPullRank","isPartOf":{"@id":"https:\/\/ipullrank.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage"},"image":{"@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage"},"thumbnailUrl":"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png","datePublished":"2024-05-20T14:55:42+00:00","dateModified":"2025-04-27T01:54:35+00:00","description":"Use this Google Sheets Apps Script to find k-Nearest Neighbors across your site with a highly relevant cosine similarity score.","breadcrumb":{"@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#primaryimage","url":"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png","contentUrl":"https:\/\/ipullrank.com\/wp-content\/uploads\/2024\/05\/Frame-1597879904-1.png","width":699,"height":400},{"@type":"BreadcrumbList","@id":"https:\/\/ipullrank.com\/cosine-similarity-knn-in-google-sheets#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ipullrank.com\/"},{"@type":"ListItem","position":2,"name":"Quick Tip: Cosine Similarity and\u00a0k-Nearest Neighbors in Google Sheets"}]},{"@type":"WebSite","@id":"https:\/\/ipullrank.com\/#website","url":"https:\/\/ipullrank.com\/","name":"iPullRank","description":"Digital Marketing Agency in NYC","publisher":{"@id":"https:\/\/ipullrank.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ipullrank.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ipullrank.com\/#organization","name":"iPullRank","url":"https:\/\/ipullrank.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ipullrank.com\/#\/schema\/logo\/image\/","url":"https:\/\/ipullrank.com\/wp-content\/uploads\/2025\/03\/Logo_-_Layers.svg","contentUrl":"https:\/\/ipullrank.com\/wp-content\/uploads\/2025\/03\/Logo_-_Layers.svg","width":177,"height":36,"caption":"iPullRank"},"image":{"@id":"https:\/\/ipullrank.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/ipullrankagency","https:\/\/www.linkedin.com\/company\/ipullrank\/","https:\/\/www.youtube.com\/@iPullRankSEO"]},{"@type":"Person","@id":"https:\/\/ipullrank.com\/#\/schema\/person\/82831a4b9f4b8be81d5a9bfed4cb9b20","name":"Mike King","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ipullrank.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d57e62b40de6db99771f85cbce3ab1d29071b8cd0d643c8dcf2fc55818e1769f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d57e62b40de6db99771f85cbce3ab1d29071b8cd0d643c8dcf2fc55818e1769f?s=96&d=mm&r=g","caption":"Mike King"},"description":"Mike King is the Founder and CEO of iPullRank. Deeply technical and highly creative, Mike has helped generate over $4B in revenue for his clients. A rapper and recovering big agency guy, Mike's greatest clients are his two daughters: Zora and Glory.","url":"https:\/\/ipullrank.com\/author\/ipullrank"}]}},"_links":{"self":[{"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/posts\/17554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/comments?post=17554"}],"version-history":[{"count":0,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/posts\/17554\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/media\/18452"}],"wp:attachment":[{"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/media?parent=17554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/categories?post=17554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/tags?post=17554"},{"taxonomy":"diagnosis-deliverable","embeddable":true,"href":"https:\/\/ipullrank.com\/wp-json\/wp\/v2\/diagnosis-deliverable?post=17554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}