View Categories

How To Configure Custom Scripts With BetterLinks?

3 min read

BetterLinks PRO allows you to configure custom scripts on your WordPress website so that you can get insightful data about your shortened URLs created by BetterLinks, click-through rates, and more.

Follow the steps below to configure custom scripts with BetterLinks on your website.

How To Configure Custom Scripts With BetterLinks? #

Since custom scripts by BetterLinks is a premium feature, you need to install and activate BetterLinks PRO along with the free version of this plugin.

Step 1: Enable & Configure Custom Scripts In BetterLinks #

From your WordPress dashboard, navigate to BetterLinks → Settings → Advanced Options → Tracking.

Configure Custom Scripts

Now, check the ‘Enable Custom Scripts’ and input any scripts. Once done, hit the ‘Save Settings’ button.

[Note: Follow step 3 to learn how to collect any script to use on the BetterLinks Custom Scripts field.]

Configure Custom Scripts

Custom scripts globally apply to all the cloaked URLs. So, once you add a custom script to BetterLinks, it will automatically apply to all the cloaked links you have.

Step 2: Configure Custom Tracking Scripts #

Although custom scripts configured from the BetterLinks settings automatically applies to all the cloaked URLs, you can also add any other custom tracking scripts to an individual link if you prefer.

Configure Custom Scripts

To do that, from the ‘Manage Links’ tab of your BetterLinks tab, click the ‘Edit Link’ button, enable the ‘Custom Scripts’ button, and input your scripts. Once done, hit the ‘Update’ button.

Step 3: Collect Custom Scripts/Tags #

The custom scripts feature lets you add any scripts or tags to your website through BetterLinks and track your URLs or monitor how they are performing. For tutorial purposes, we will collect custom scripts from Google Analytics here. Log in to your Google Analytics account and navigate to Admin → Data Streams.

Configure Custom Scripts

Now, you need to choose ‘Web’ as the platform. Then, provide your website URL and set any name for your stream.

Configure Custom Scripts

Once done, hit the ‘Create stream’ button. A web stream with the necessary details will be created instantly.

configure custom scripts

Now, click on the stream. You need to view tag instructions to collect your stream data and tags. On the next screen, select ‘Install Manually’ and copy the Google tag for use in the BetterLinks settings.

configure custom scripts

Final Outcome #

After adding your custom scripts, you can check and track the shortened URL and how it is performing from the custom tool’s end. For example, we have used custom tags from Google Analytics here. Now, whenever someone clicks on the shortened URL by BetterLinks, it will automatically be tracked and recorded from Google Analytics, as shown below.

configure custom scripts

Supported Redirect Types For BetterLinks Custom Scripts #

Our custom script currently only supports Cloaked Redirects, where the targeted URL is loaded within an iframe, allowing us to run scripts on that page.

However, server-side redirects like 301, 302, and 307 go directly to the target URL. Since JavaScript works on the client side, these redirect types do not allow running any scripts while redirecting.

That is how easily you can configure custom scripts with BetterLinks.
Getting stuck? Feel free to contact our support team for further assistance.

Powered by BetterDocs

Wait… Before You Leave

Enter 2025 with BIG savings & a boost to your business.

  • 00Days
  • 00Hours
  • 00Mins
  • 00Secs