Skip to main content

URL shortener integration for a Drupal website

Blog image

Brevity and simplicity are great characteristics of web page URLs. No wonder that URL shorteners are very popular. Our web development agency creates appealing, feature-rich, and user-friendly websites. Today we are sharing a post on URL shorteners: what they are, why they are used, and how to integrate a URL shortener with a website.

If your website is built on Drupal, the second part of the post will be especially interesting for you because we will discuss URL shortener integration on Drupal websites.

What is a URL shortener?

A link shortener is a service that reduces the length of your URL. Even web addresses over a hundred characters long can turn into trimmed links that do not exceed 20 characters. The underlying technology is web page redirection. A user clicks on the short address and is navigated to the long one. Famous examples of link shorteners include, but are not limited to Bitly, TinyURL, Bag.gy, Ow.ly, and Yourls.

Bitly link shortener

Reasons to use a link shortener

Initially used for Twitter, links shorteners have become a common practice in a variety of marketing activities. Here are a few scenarios in which the link shortening technique is used:

  • There are restrictions on the allowed number of characters imposed by messaging apps — for example, link shorteners became especially popular due to Twitter’s rule of 140 characters in one tweet.
  • You need to make the URL easy to remember and put it on a print resource (banner, presentation, etc.)
  • Your goal is to beautify your links and make them more aesthetically appealing, which should convince more visitors to click.
  • You want to learn your customers’ behavior by using the monitoring features in famous URL shorteners.
  • You want to use the UTM parameters, or tags, added to your URLs for the purpose of tracking the user behavior. These usually look long, but link shorteners can make them much shorter.
  • You want to use advanced features like changing destination addresses, link retargeting, traffic splitting, and more.

Link shortener integration with a website built on Drupal

You can use link shorteners directly on their own websites, where you just need to enter the long address and grab the short address.

However, it’s a more interesting idea to integrate a link shortener with a website. In particular, we will see how to integrate Drupal with a link shortener.

To set up URL shortening in Drupal, you can use a third-party service integration via a URL shortener API or just the Pathauto module to auto-generate short web addresses. However, the most convenient way is to use a contributed module to perform URL shortener integration for Drupal.

Drupal modules to integrate your website with a link shortener

Shorten URLs

The Shorten URLs is an easy-to-use and lightweight module that provides an API to integrate Drupal with TinyURL, Bitly, and a dozen of other link shortener services. It is used by other modules as well because it is primarily an API. The Shorten URLs module is ready both for Drupal 7 and Drupal 8 sites.

It offers an intuitive user interface for URL shortening as a page or a block. In addition, there is a block that displays the current page’s shortened address is meant for quick copying.

The module comes packed with four submodules:

  1. The Shorten URLs as the main module provides an API and user interface for URL shortening using common services.
  2. The Record Shortened URLs submodule tracks and shows the statistics of shortened URLs to website admins.
  3. The Shorten URLs Custom Services submodule allows you to add custom URL shortening services via the UI.
  4. The Shorten URLs Input Filter submodule offers an input filter for automatic URL shortening in the text.
Shorten URLs Drupal module

ShURLy

The ShURLy is a URL shortening service created as a Drupal module. It has a stable Drupal 7 version, but Drupal 8 websites will need to wait a little because ShURLy for Drupal 8 is in development. The ShURLy module has plenty of interesting features, some of which are as follows:

  • Clicks are tracked on short URLs.
  • Authenticated users can track their URLs activity.
  • You can auto-generate URLs or enter custom short URLs.
  • There are fine-grained permissions based on user roles.
  • There is a click-to-copy-to-clipboard feature.
  • URLs are case-sensitive.
  • There is a web services API for shortening or expanding the URLs.

Bit.ly for Drupal

The Bit.ly for Drupal module for Drupal 7 helps you integrate Drupal with Bitly. It provides a rich API that enables other modules to use the Bitly features (shorten or expand links and view their statistics). With this module, users can link their Bitly account to their Drupal profiles. Site admins can enter their Bitly API and oAuth details. The module integrates with the Shorten module we have described above.

Bit.ly for Drupal module

Let us help you integrate your website with a link shortener

Hopefully, the basics of how to integrate with a link shortener will be helpful to you. Contact our Drupal maintenance and support agency for Bitly integration with Drupal or if you want to use any other link shortener on any kind of website. We will install and configure the right modules or create custom functionality from scratch at very affordable prices.