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.
Get started with the Linking Agent in minutes. We will provide your API key and help you configure the integration.