Add Similar AI internal links to any website using a client-side JavaScript snippet or Google Tag Manager. No server-side changes required.
In addition to the server-side integration, the Similar AI Linking Agent API also works with a client-side integration. You can add a script block manually or use Google Tag Manager (GTM), then place an empty HTML element in your template (for example, in the footer). The script pulls links using the API key we provide and updates the page automatically.
This approach works well for sites where you cannot modify server-side rendering, including static site generators, hosted platforms, and CMS tools like Ghost.
The simplest approach is to add a script tag and an empty HTML element directly to your page template. The script loads asynchronously and populates the element with internal links returned by the Linking Agent API.
Place this script tag in your HTML. Replace XXX with the API key we provide. Contact us if you do not have one yet.
<script src="https://isentropic-snow-282609.ew.r.appspot.com/api/js-internal-linking/?apikey=XXX" defer ></script>
Place this empty element where you want the internal links to appear - typically in the footer or sidebar of your template.
<div id="similarai-relatedSearches" class="nav"></div>
Once both are in place, the script will fetch links from the Linking Agent API on each page load and render them inside the element. No further configuration is needed.
If you manage scripts through GTM, you can add the Linking Agent integration as a custom HTML tag. This gives you control over which pages load the script and when.
Go to your GTM workspace, navigate to Tags, and create a new Custom HTML tag with the following content. Replace XXX with your API key.
<script>
var script = document.createElement('script');
script.defer = true;
script.src = "https://isentropic-snow-282609.ew.r.appspot.com/api/js-internal-linking/?apikey=XXX";
document.getElementsByTagName('head')[0].appendChild(script);
</script>Create a trigger for the tag. For example, use a Page View trigger filtered to the pages that should pull internal links from Similar AI. You can target all pages or use a URL path condition to limit it to specific sections of your site.
Just like the direct approach, you still need the empty container element in your HTML template:
<div id="similarai-relatedSearches" class="nav"></div>
Use GTM Preview mode to verify the tag fires correctly on your target pages. Once confirmed, publish the container.
You can integrate Similar AI by placing a client-side script tag in your page template, which automatically queries the Similar AI Linking Agent and injects relevant internal links into designated HTML elements. No server-side changes are required - just add the snippet once and all matching pages update dynamically.
Yes, the Similar AI JavaScript snippet can be added as a Custom HTML tag inside Google Tag Manager, triggered on the page views where you want internal links to appear. This means your development team doesn't need to be involved for initial setup or future configuration changes.
You designate target elements by adding a specific data attribute or CSS class to the containers where you want internal links rendered, such as product descriptions or category introductions. The script then scans those elements and inserts contextually relevant links identified by the Linking Agent.
The snippet is designed to load asynchronously so it does not block your page's critical rendering path. Link injection happens after the main content is interactive, keeping Core Web Vitals scores unaffected by the integration.
Yes, the JavaScript and GTM integration is a delivery layer that surfaces links generated by the Linking Agent, which itself draws on the full Similar AI platform including signals from the Content Agent and New Pages Agent. Any new pages or content updates made by those agents are automatically reflected in the links the script injects, without requiring you to update your GTM configuration.
Get started with the Linking Agent in minutes. We will provide your API key and help you configure the integration.