Link Cloaking Plugin for WordPress
I’ve created a plugin for WordPress that can cloak outgoing links in your posts and/or pages.
Features
- Choose what to cloak – all links, only the links you specify or no links at all.
- Choose where to cloak – posts, pages or both.
- Configure the URL – you can set the “prefix” part of the URL (see examples below).
- Exception list – links pointing to domains in this list will not be cloaked. For example, this is useful if you have chosen to cloak all links but don’t want to cloak the links to your own domains.
- Compatible with all browsers – the link cloaker plugin doesn’t use JavaScript so it will work even for visitors that have disabled JS.
- “Smart” cloaking – relative, ambiguous or malformed URLs will not be cloaked. Better safe than sorry.
- As of version 1.1, static link cloaking.
New! The premium version of this plugin is now available and includes several new features :
- Cloak links in any part of your site, including the comment section and the sidebar.
- Works with plugin-created links.
- Five new cloaking types – for example, you can display the cloaked URL in a frame, or use a special redirect that hides the referrer.
- Improved link management and click statistics.
- Free automatic updates.
- And more. Check out EclipseCloaker.com for complete details.
Examples
Here’s a link explicitly tagged for cloaking -
<a href="http://evil-guide.tripod.com/"><!--cloak-->A Cloaked Link</a>
And here’s what it looks like in the post – A Cloaked Link
If you have configured the plugin to cloak all links (the default) you don’t need the <!–cloak–> tag inside your links.
Installation
- Download the link-cloaking-plugin.zip file.
- Unzip the file.
- Upload the `link-cloaking-plugin` folder to the `/wp-content/plugins/` directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- (Optional) Go to Settings -> Link Cloaking and modify the default settings to your liking.
- Re-save your permalink settings to insert the plugin’s link redirection code to the WordPress .htaccess file : go to Settings -> Permalinks and click “Save Changes”.
Download
Version 1.8.2 : link-cloaking-plugin.zip (10 KB)
Requirements :
- WordPress 2.8 – 3.0.1
mod_rewrite. If “pretty permalinks” work on your blog then you probably have this already.
I’ve thought about it, but it would be very tricky to do and probably cause conflicts with some other plugins like WP-SuperCache. Perhaps someday
[...] [...]
Rick,
All the way from http://www.internetmarketingforums.net.
This is great information. You have a knack.
Just a shout out and will give it a tweet too!
mike
[...] [...]
[...] Link Manager [...]
i dowloaded your plugin sometime ago and im using it all the time. its great so far so thanks a lot for it…now here comes the question:there is a simple tracking implemented in this plugin, it shows you how many times cloaked link have been clicked.unfortunately it shows you overall number of clicks for a link…what if i want to see how many clicks were made daily?so lets say i have these 50 links, i would like to see some kind of general DAILY summary how many times links have been clicked.i know it may be too much to implement it in the plugin but maybe you have some idea how to track it using some analytics or other tracking plugin…i was trying to figured it out but wasnt luck yet…any ideas would be much appriciated!
so how do you daily track your cloaked links?anyone happy to help?
I think there might be a way to do it with Google Analytics. The “/goto/” (or whatever prefix you have) should look like a normal directory to GA and thus the details should be available in GA -> Content -> Content Drilldown. Unfortunately I can’t test this myself, as I have very few cloaked links on this site.
If it doesn’t work right away you can probably force GA to track those clicks using something similar to the code that this plugin uses to track outgoing links.
Does anyone get an Internal Server Error when the plugin is activated? Mine does and I don’t know whats wrong.
thanks a lot for your fast response.
ga doesnt track /goto/ at least for me…its something to do with “outbound” links (although your links are outbound as they are cloked they seem to be inbound)
Unfortunately /goto/ doesnt show in content drilldown…i tired to find it there before and no no
so tehre is a solution for outbound clicks and you kind fo mention it…you need to tag all your links with onclick parameter.The problme is that i have quite a lot of cloaked links all over the place, and tagging them manually seems like a waste of time. i havent tried oratranslplant plugin yet, i was trying to do the same with yoast – ga for wordpress plugin that is supposed to tag all outbound links automaticlly but it seems it doesnt like links your plugin create…so i dont know really…i thought you may have some solution you are using yourself or other people figured out how to do that. ill try plugin you mentioned and see what happens.thanks anyway!
You might also be able to adapt this script for your needs.
I am having a similar problem to Your Netbook above, but the solution seems to be different. I have resaved the permalinks and the code appears in the htaccess file as it is supposed to (code appears below). The links are cloaked in the status bar, but when you click one, it redirects to my homepage.
Does it matter that the affiliate links use this format already?:
?url=
(as in this CJ affiliate link:) http://www.anrdoezrs.net/click-(feed-id)-(my-aff-id)?url=http://www.merchant-site.com/
# Link Cloaker Plugin BEGIN
RewriteEngine On
RewriteRule goto/([^/]*)/([0-9]+)/([0-9]+)/? http://tickets-below-face-value.com/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?post_id=$2&link_num=$3&cloaked_url=$0 [L]
RewriteRule goto/([^/]+)[/]? http://tickets-below-face-value.com/wp-content/plugins/link-cloaking-plugin/wplc_redirector.php?name=$1&cloaked_url=$0 [L]
# Link Cloaker Plugin ENDS
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
The plugin redirects to the homepage when it can’t find the original link in the source post. Links in the “?url=” format should be fine (I checked).
This problem usually happens when the link is added by another plugin. Does that give you any clues?
Thanks White Shadow. I think it might.
I am using ExecPHP, which allows me to put php inside the post and executes it for me. The affiliate links are generated dynamically by the php script inside the post or pulled directly from the database.
Any way to get the cloaker to work anyway?
This has been a common request and will be added in a future version. However, that version may very possibly be commercial.
Hi,
Please can you help.
I have spent many hours trying to get the link cloaking plugin to work.
I have read all of the recent forum posts and have done all the things that are talked about. Updated permalinks , checked htaccess files they are all OK and still no success.
I have tried creating posts in two different domains that I have. One is on wordpress version 2.8.1 and the other on 2.8.2. They have different themes – one is dateless sniper and the other is on Semiologic. But there is no difference.
I do not know which way to turn next. When I am creating a post should I be able to see the cloaking process within the link because at the moment the link just looks like a normal link when viewed in the html window.
I await your comments.
So what exactly doesn’t work? Is it that links don’t get cloaked, or that they don’t redirect properly?
A cloaked link will look the same when creating or editing a post. The actual cloaking happens when the post is displayed on the blog (this should also work in the post preview, if you use that).
If you can’t get any links to cloak, check the settings page – maybe you’ve got selective cloaking turned on when what you really want is the “cloak everything” option. Or maybe the exclusion list contains something that it shouldn’t.
[I got your email, but couldn't respond to it - my email got bounced with a "No such user" error message. So I'm posting my comment here.]
Ah, I see.
However, that behaviour is *by design* – it’s supposed to show the
original URL in the address bar when you actually visit that page. The
cloaking is currently only useful to hide the destination of the link from
people browsing your site and, say, hovering their cursor over a link to
see where it leads – not for fooling those who actually click the link.
I’m currently working on an improved version of the plugin that will have
the option to display the linked page inside a frame, which would create
the effect you desire.
How exactly do you make his plugin work, when you have fancy permalinks. Please help.
Generally you just have to update your permalinks (click “Save Changes” on the permalink settings without actually changing anything).
[...] first commercial WordPress plugin later this month. The plugin will be an improved version of the Link Cloaking plugin and will include a bunch of new and exciting features, like cloaking links anywhere on the site (as [...]
Hi,
Does your plugin work with WP 2.8.4? I just upgraded and I think the plugin no longer works. My cloaked links now show 404 pages
Yes, 2.8.4 should work fine. You probably need to update your permalinks again (and check the .htaccess to make sure the cloaker code is above the WP code).
Hi,
I’ve rechecked my htaccess and nothing wrong there. Why I think it doesnt work with WP 2.8.4 is because I have 2 sites, one is WP 2.7.1 and the other I upgraded to WP 2.8.4.
The one with WP 2.7.1 is still working fine. The one with WP 2.8.4 is NOT
I also have a site on another server and this one also the plugin failed to work after I upgraded to WP 2.8.4.
When I meant fail, it means Failed to redirect….so ends up with a Page Not Found (404)
This site also runs on WP 2.8.4 as well, so I’m quite sure the plugin should be compatible with it.
Could you perhaps email me your .htaccess and site URL? Maybe that would help me find some clues. My email is whiteshadow (@) w-shadow (.) com
I realised a “bug” in your script. If the URL has an space inside the link wont be cloaked.
@Marco : Fixed. You can download the updated version via the download link in the post above.
It would be nice if you can extend your plugin with “link cloaking in comments”!
Hi. Me again.
I left a comment a few weeks ago about how the plugin was not cloaking rover.ebay.com stuff on my blog (although it seems to be working for everything else). Well, over the weekend I upgraded the plugin to 1.2.7 and now it’s working again. Not sure why it stopped, but things are ok now. Except…
Now sure if you recall, but at one point I asked why the plugin didn’t seem to function with my version of the_excerpt_reloaded (I say “my” version – it’s essentially unchanged other than I overrode the defaults in the plugin). I am forcing the plugin to display an excerpted version of the_content.
Question – it’s pulling the content as $post->post_content? Does that pull the content before your plugin has filtered it?
Any help or insight would be greatly appreciated!
The cloaker filters the post in the “the_content” hook. If the excerpt plugin deals with $post->post_content directly (without calling the aforementioned hook), the cloaker probably won’t catch the post and thus won’t cloak it.
Try modifying the excerpt plugin so that it calls
before it outputs the excerpt. Obviously you’ll need to replace “$excerpt” with whatever variable the plugin uses.
Hmmm.
Right before
return $output;
I added
$output = do_action( “the_content”, $output);
Now all I get is titles (no excerpt). Did I misunderstand?