Betterlink - Webmaster Setup

  • Step 1 of 2: Integrate JavaScript Library

Adding Betterlink to your website is easy. We'll do most of the heavy-lifting for you.

Betterlink comes in two flavors: the standard setup for most clients, and a customizable setup for advanced users. Below, we'll sprint through the one-size-fits-most setup.

For more details on:

  • customization options
  • handling dyanmic content on pages
  • supporting links for desktop and mobile

...or anything else, please refer to our full documentation.


Bullet Point Setup

In most cases, there's two basic steps:

  1. Copy the Betterlink script
  2. Paste into your webpages

1. Copy the below script.

Script Text

    <script>
      (function(d,s,id){
      var js,fjs = d.getElementsByTagName(s)[0];
      if(!d.getElementById(id)){
      js=d.createElement(s); js.id = id; js.defer = true;
      js.src="//code.betterlink.io/betterlink.js";
      js.setAttribute('data-script-source','within source');
      fjs.parentNode.insertBefore(js,fjs);}
      }(document,'script','betterlink-js'));
    </script>

In simpler terms, this creates the following script element for your page:

    <script defer id="betterlink-js" src="//code.betterlink.io/betterlink.js" data-script-source="within source"></script>

The only difference is that we structure the script tag specially so that it doesn't block any other content on your page from loading.

2. Paste into your webpages.

Make sure you get it on all of the pages on your site.

Quick and simple answer: you should add Betterlink just before the closing </body> tag on your webpages

Initializing Betterlink

The good news: If you're following this simple setup, you're all done!

When your browser loads the Betterlink script, it will automatically enable content sharing. We'll also automatically check if a visitor followed one of your new special links. If so, we'll take them to the requested portion of the page and highlight the content.

If you're concerned about any of the below topics, check out our Advanced Setup:

  • Redirecting mobile users (so they can see the same highlighted content)
  • Linking to dynamic content on a page (content that changes or displays sometime after the page initially loads)
  • Linking to content that displays when a hash is loaded in the URL (like http://example.com#my_content)
  • Customizing the look and feel of the highlights
  • Using permalinks to link to pages that change their address
Next Step ›› Customize

Get Betterlink