How I Built 4 SEO Bookmarklets with AI Tools

Let’s begin with what are Bookmarklets.

Bookmarklets or otherwise called JavaScript Bookmarklets is something you can create by going into your browser’s Bookmark Manager & adding a new bookmark which is essentially going to be the JavaScript code that will do the job of doing a certain task in an expedited manner.

A basic example of a Bookmarket can be let’s say scraping canonical URLs from the page that you’re on.

The goal of this post is to show the 4 useful Bookmarklets I built using AI’s help but if you want to know how to make a bookmarklet then you may read this tutorial by freecodecamp.

Here is an example of you can just using a prompt build a bookmarklet

bookmarketlet using AI

4 Bookmarklets that are helping me as an SEO

1. Scrape Question Titles from SERP

				
					javascript:(function(){     let titles = [];     document.querySelectorAll('h3').forEach(h3 => {         let title = h3.textContent;         if (title.includes('?%27))%20{%20%20%20%20%20%20%20%20%20%20%20%20%20titles.push(title.trim());%20%20%20%20%20%20%20%20%20}%20%20%20%20%20});%20%20%20%20%20if%20(titles.length%20%3E%200)%20{%20%20%20%20%20%20%20%20%20let%20text%20=%20titles.join(%27\n%27);%20%20%20%20%20%20%20%20%20navigator.clipboard.writeText(text).then(()%20=%3E%20{%20%20%20%20%20%20%20%20%20%20%20%20%20alert(titles.length%20+%20%27%20title(s)%20with%20question%20marks%20copied%20to%20clipboard.%27);%20%20%20%20%20%20%20%20%20}).catch(err%20=%3E%20{%20%20%20%20%20%20%20%20%20%20%20%20%20console.error(%27Failed%20to%20copy%20text:%20%27,%20err);%20%20%20%20%20%20%20%20%20%20%20%20%20alert(%27Error:%20Could%20not%20copy%20to%20clipboard.%20See%20console%20for%20details.%27);%20%20%20%20%20%20%20%20%20});%20%20%20%20%20}%20else%20{%20%20%20%20%20%20%20%20%20alert(%27No%20titles%20with%20question%20marks%20found.%27);%20%20%20%20%20}%20})();
				
			

The way I like to use this bookmarklet is by doing a search like site:reddit.com “my topic”

As a result, I see a lot of Reddit questions on SERP. Just by running this Bookmarklet, it scrapes only those SERP titles that contain question marks in it, those are genuine human questions which I can address in my content by providing answers to them. This is a good productivity hack when it comes to expanding your FAQ list.

2. Scrape the SERP

				
					javascript:(function() {     function extractResults() {         var results = [];         var searchResults = document.querySelectorAll('.g');                  searchResults.forEach(function(result) {             var titleElement = result.querySelector('h3');             var linkElement = result.querySelector('a');                          if (titleElement && linkElement) {                 var title = titleElement.textContent.trim();                 var url = linkElement.href;                 results.push(title + ',' + url);             }         });                  return results.join('\n');     }      var extractedData = extractResults();          if (extractedData) {         navigator.clipboard.writeText(extractedData).then(function() {             alert('Search results copied to clipboard!');         }).catch(function(err) {             console.error('Failed to copy: ', err);             alert('Failed to copy. Please check the console for details.');         });     } else {         alert('No search results found.');     } })();
				
			

The way I use this is, I can do a search for a keyword on Google, click this bookmarklet & it will scrape all the results from the SERP. 

It will scrape the title & Ranking URL which is copied into the clipboard which I can then paste wherever I want to do the analysis.

3. Scrape SERP + Meta Title Character Count

				
					javascript:(function() {     var results = document.querySelectorAll('.g');     var output = '';          results.forEach(function(result, index) {         var link = result.querySelector('a');         var title = result.querySelector('h3');                  if (link && title) {             var url = link.href;             var titleText = title.textContent;             var titleLength = titleText.length;                          output += `${index + 1}. URL: ${url}\nTitle: ${titleText}\nTitle Length: ${titleLength}\n\n`;         }     });          if (output) {         navigator.clipboard.writeText(output).then(function() {             alert('SERP data copied to clipboard!');         }).catch(function(err) {             console.error('Failed to copy: ', err);         });     } else {         alert('No results found on this page.');     } })();
				
			

This bookmarklet not only scrapes the SERP but also tells me the title character count. I find it handy because for certain kinds of SERP there can be character count discrepancy which can help me determine whether longer title would affect me or should I even focus on length.

4. Scrape Internal Links + Anchor from the Page

				
					javascript:(function(){function i(u){try{const l=new URL(u,window.location.href);return l.hostname===window.location.hostname&&!l.hash&&!l.search}catch(e){return false}}function g(){const e=document.body;function x(n){return['header','nav','footer'].some(t=>n.closest(t))}return Array.from(e.querySelectorAll('p a, li a')).filter(a=>!x(a)&&i(a.href)).map(a=>`${a.href},${a.textContent.trim()}`).join('\n')}const l=g();if(navigator.clipboard)navigator.clipboard.writeText(l).then(()=>alert('Filtered internal links copied!')).catch(e=>alert('Copy failed: '+e));else{const t=document.createElement('textarea');t.value=l;document.body.appendChild(t);t.select();try{document.execCommand('copy');alert('Filtered internal links copied!')}catch(e){alert('Copy failed: '+e)}document.body.removeChild(t)}})();
				
			

This bookmarklet I use when I am on a web page of a certain website & if I want to understand internal links flowing from that page to others & using what anchor text. I can immediately find that out using this Bookmarklet.

So there it is 4 Bookmarklets that are helping me in SEO. I will keep updating this list as I find & create more & more bookmarklets.

Leave a Comment