Full-Page Script

Last Updated August 21, 2022

 

This script allows you to easily shorten all (or select) URLs on your website. All you need to do is to copy and paste the code from your account at the end of your page. 

You can customize the selector as you wish to target URLs in a specific selector. Note you can just copy the code from your account because everything is already set up for you.

For Example:

<script type="text/javascript"> var key = "3259b2d515b88abdf2d80f0279";</script>

<script type="text/javascript" src="https://linko.me/script.js"></script>


Choosing a different domain

By default, the script uses the default domain on the platform. However, you can define a custom domain name to shorten links with. You need to make sure the domain is exactly the same as the domain added to your account, including the schema (HTTP/HTTPS).

For Example:

<script type="text/javascript"> var key = "3259b2d515b88abdf2d80f0279"; var domain = "https://mydomain.com";</script>

<script type="text/javascript" src="https://linko.me/script.js"></script>


Choosing custom selectors

By default, this script shortens all URLs on a page. You can add a selector parameter if you want to target specific URLs. You can see an example below where the script will only shorten URLs having a class named "mylink" or all direct links in the " .content container " or all links in the " .comments container ".

For Example:

<script type="text/javascript"> var key = "3259b2d515b88abdf2d80f0279"; var selector = ".mylink, .content > a, .comments a";</script>

<script type="text/javascript" src="https://linko.me/script.js"></script>


Excluding domain names

You can exclude domain names if you wish. You can add an exclude parameter to exclude domain names. The example below shortens all URLs but excludes URLs from google.com or apple.com.

For Example:

<script type="text/javascript"> var key = "3259b2d515b88abdf2d80f0279"; var exclude = ["google.com","apple.com"];</script>

<script type="text/javascript" src="https://linko.me/script.js"></script>


Restricting domain names

You can restrict domain names by adding an include parameter to restrict domain names. The example below shortens all URLs within the included domain name.

For Example:

<script type="text/javascript"> var key = "3259b2d515b88abdf2d80f0279"; var include = ["google.com"];</script>

<script type="text/javascript" src="https://linko.me/script.js"></script>


Back to Documentation click ⇾ Here