How To Automatically Cloak Affiliate Links In Drupal
If you are looking for the best way to cloak and track affiliate link in drupal, Here is the tutorial you are looking for. Using this tutorial, I will show you how to automatically cloak an external or affiliate link in drupal 7 using Go module.
Most of the SEO’ers recommend hiding affiliate links and block them using robots.txt file for SEO purpose. It was a lot easier in WordPress and Joomla but, finding a trusted solution in drupal for hiding affiliate links from being displayed is bit tricky for beginners. That’s why, In this tutorial, I will show you how to automatically cloak affiliate links in drupal using go module.
The go module (also called as GoTwo) is a drupal contributed module that can help you in cloaking and tracking affiliate links in drupal 7. This module can also track how many people clicked a link and allows admin to add a disclaimer when people clicked a link.
Here is how to configure go module for automatic affiliate or external link cloaking and tracking:
Install And Configure Go Module
The very first step is installing go module using the standard module installation method, No tricks required here.
Step 1: Install and enable Go Module (
an example of link cloaked with Go Module)
Once Go module installed and activated, enable it from Text Format configuration to make sure it work properly.
Step 2: Go to Configuration > Content authoring > Text formats
Now click on the configure of the text format you are using. In my case I’m using Full HTML.
And check the box labeled “Go” redirection filter
and save the settings by clicking on Save configuration button.
Now you are ready to cloak affiliate or external links using Go module.
Configure Go settings
Once you have done installing go module and configuring text format, Now you will have to configure Go module settings for additional features like Global filter configuration & Disclaimer.
To do that, Visit Configuration > Search and metadata > Go settings
The go settings is already configured for link cloaking. The default configuration of Go settings will create numerical url
yourdomain/go/12345 instead pretty url like
yourdomain/go/affiliate-link. If you want to use pretty url instead numerical, You need Transliteration module installed and activated. If you already have it, check the box labeled “Transliterate URLs”. You can also configure URL separator and maximum length of url labels.
Once you have your own global filter configuration now scroll down for Disclaimer configuration section. Here is my current Disclaimer enabled settings:
If you don’t want to use disclaimer when people click a link, then just ignore this step and click on the Save configuration button.
How To Use Go Module To Cloak a Link automatically
Once you have configured Go module, Now you can use it to cloak a link automatically while editing or writing content.
All you have to do is, Add a link as you do normally and then replace
go, just like
That’s it, Once you save this, your link will appear as
http://yourdomain.tld/go/example.com that will redirect to
- Also Read: How to add a related content block in drupal
You can also change the link label or hide the destination link from being displayed by using
title attribute like:
<go href="http://example.com" title="hidden link">example</go>
This will create a go url like
As i wrote earlier, Go module also track click count as well. You can check how many people click a link from Administration > Structure > Go redirects.
Now you have a fully functional external or affiliate link cloaking system in your Drupal 7.
Now you need to block these type of links using robots.txt file for SEO purpose. To do that, edit robots.txt file and add:
That’s all! Do you know any other ways to cloak external or affiliate links in drupal? Let us know using the comments below.