If the Similar AI WordPress plugin does not work for your setup, you can integrate the Similar AI API using client-side JavaScript instead. Two approaches below.
WPCode lets you inject custom JavaScript into your WordPress site without editing theme files. Make sure the WPCode plugin is installed and activated before proceeding.
Navigate to your WordPress admin dashboard and open the Headers & Footers settings in WPCode. Paste the Similar AI JavaScript snippet into the Footer section. This ensures the script loads on every page.
<!-- WPCode > Headers & Footers > Footer --> <script src="https://api.similar.ai/your-site/internal-links.js"></script>
In the WordPress block editor, add a Custom HTML block where you want the internal links to appear. Paste the following container div:
<div id="similarai-relatedSearches"></div>
If the block editor switches back to visual mode, click the three-dot menu on the block and select Edit as HTML to re-paste the code. The JavaScript loaded in the footer will find this container and populate it with internal links automatically.
If you prefer not to use a plugin, you can add the script directly to your WordPress theme footer template. This gives you full control and avoids a plugin dependency.
Go to /wp-admin/theme-editor.php?file=footer.php in your WordPress admin, or navigate to Appearance > Theme File Editor and select footer.php.
Insert the Similar AI script just before </body> in footer.php:
<!-- Add before </body> in footer.php --> <script src="https://api.similar.ai/your-site/internal-links.js"></script>
Add the target container wherever you want the links to render. You can place it inside your post template or directly in individual posts using a Custom HTML block:
<div id="similarai-relatedSearches"></div>
Once saved, the script will detect the container and populate it with relevant internal links on each page load.
For a Google Tag Manager approach instead of direct script injection, see the JavaScript and GTM integration guide. If you want a server-side WordPress integration, try the WordPress plugin guide first.
Client-side internal linking uses JavaScript injected into your WordPress pages to dynamically insert internal links after the page loads in the browser. This approach lets Similar AI's Linking Agent add and update links across your store without modifying your WordPress theme or database directly.
You can either use the WPCode plugin to paste the JavaScript snippet into a code block, or inject the script directly into your theme's footer template file. The WPCode method is recommended for non-developers because it doesn't require editing theme files and survives theme updates.
The script is loaded asynchronously and executes after the main page content is rendered, so it has minimal impact on page load times. Similar AI's Linking Agent only targets relevant anchor text matches, keeping DOM manipulation lightweight and focused.
Modern search engines, including Googlebot, render JavaScript and can follow client-side links during indexing. However, for best results Similar AI recommends monitoring your Google Search Console crawl reports to confirm links in your specific WordPress setup are being discovered and followed.
The WPCode plugin method requires no coding knowledge-you simply copy the snippet provided by Similar AI and paste it into a new code snippet within the plugin. The footer template method requires basic familiarity with WordPress theme file editing, so that option is better suited to developers or technically confident store owners.
Similar AI generates relevant internal links that help visitors and search engines discover more of your content. Set up takes minutes.