The link cloaking I’ve added to the Stallion Responsive Theme and Stallion WordPress SEO Theme is a very cool feature.
Why Hide/Cloak Affiliate Links?
There are two reasons to hide/cloak affiliate links (any link).
1. Hide the source of the link from your visitors so they don’t know they are about to go to an affiliate site AND so other affiliates can’t easily steal your affiliate links (apparently it’s a problem).
2. To protect a sites link benefit, Google does not want us linking to affiliate sites and other sites we don’t recommend. Unfortunately Google took away the only way to tell Google etc… a link shouldn’t pass link benefit when it changed how nofollow links work (stupid Google). A nofollow link used to pass no link benefit to the page it was linking to and the ‘saved’ link benefit was reused on the followed links from the page. Google currently deletes the link benefit of nofollow links so we should avoid using nofollow!!!
WordPress Theme Link Cloaking
Stallion uses advanced javascript and css coding to ‘hide’ affiliate links from Google and other search engines, it works because search engines don’t read the javascript/css coding as a link (it’s not a link, the javascript makes it act like a link). The downside of this is a small number of your real visitors (estimated below 10%) who have javascript turned off will not see the links either, they will only see the anchor text of the link.
This is not actually cloaking the links for your visitors, you can still see the source of the links as you hover over them (when javascript is turned on), but to search engines they are cloaked/hidden.
If you run the Massive Passive Profits Autoblog Plugin or the WP Robot Autoblog Plugin Stallion can automatically ‘hide’ the affiliate links from search engines.
Note: the link above to WPRobot is an affiliate link that has been cloaked using a simple PHP redirection script (see later) AND uses the Stallion link cloaking feature to ‘hide’ it from search engines, this is the code I used:
<span class="affst" title="outboundz" id="1">WP Robot Autoblog Plugin</span>
After reading this link cloaking tutorial you will be able to setup similar cloaked affiliate links on your WordPress blog.
If you run the Massive Passive Profits Autoblog plugin and have turned link cloaking on your Amazon affiliate links etc… will be cloaked/hidden from search engines, same for WPRobot, most affiliate links are automatically cloaked by Stallion Responsive. If you view source of an autoblog page you will see the affiliate links have been replaced with some code that looks like a link (the javascript/css coding converts it to a link), you can see the code later in this tutorial.
How to Cloak/Hide a Link Using Stallion
Lets say you have a standard text link like this one:
<a href="https://stallion-theme.co.uk/">Stallion Theme</a>
This links to the Stallion home page “https://stallion-theme.co.uk/” with the anchor text “Stallion Theme”. This is the actual link: Stallion Theme.
It’s very easy to turn it into a hidden link using Stallion by changing it to.
<span class="affst" title="tests" id="https://stallion-theme.co.uk/">Stallion Theme</span>
You place the URL https://stallion-theme.co.uk/ in the id=”” part of the code and the anchor text (Stallion Theme) before the closing </span>. As long as “Cloak Affiliate Links” is turned on under the “Stallion Promotion Options” page it will be cloaked/hidden.
That’s it the link is cloaked/hidden from Google. You can do this manually to any link that Stallion has access to within the content of a post or page linking to any page.
You can do the same with image links by replacing the anchor text with image code:
<span class="affst" title="tests" id="https://stallion-theme.co.uk/"><img src="https://stallion-theme.co.uk/wp-content/uploads/premium-wordpress-theme.png" alt="Stallion Theme" /></span>
Note if a visitor has javascript turned off they would see an non clickable image only.
Basically if you have any link with format:
<a href="...">...</a>
It can be replaced with the code above.
WordPress Simple PHP Redirection Script to Hide AND Cloak Links
The above feature is pretty cool on it’s own, you can use it to save all that link benefit that would be wasted by linking to affiliate sites directly or using nofollow links, but it doesn’t hide where the link goes to, to your visitors. Now the interesting part is when we bring in other tools.
I’ve been using a free very simple PHP redirection script for years. I have it installed on this domain and use the script for a lot of affiliate links, especially Clickbank products (the WP Robot autoblog link above uses the script, hover over it and you’ll see the ….co.uk/go/go.php?id=1 URL.). This means if an affiliate product is no longer available (happens a lot with Clickbank products) you edit one file related to the redirection script and every link to that affiliate product is changed (you could link it to a similar affiliate product for example).
You can get the free PHP Redirection Script here (note used the cloaking code to hide this link, no link benefit wasted) and install it on one of your domains. I put it under the folder /go/ and renamed some of the files (I forget why), but doesn’t really matter where you put it you can keep the default settings.
My settings results in links like this:
https://stallion-theme.co.uk/go/go.php?id=##
Where ## is a number.
If you go with the defaults your setup will be something like this:
http://www.domain.com/ccount12/click.php?id=##
To incorporate this script into Stallion edit the links.js file or the links.php file found in the /stallion-responsive/js/ folder (links.php is the inline javascript version added to Stallion Responsive 8.2).
Note: in Stallion WordPress SEO 7 it was test.js under /stallion-wordpress-seo/, same file, minor changes.
You will find this line of code:
case 'outboundz': theURL = 'https://stallion-theme.co.uk/go/go.php?id='; break;
Change to:
case 'outboundz': theURL = 'http://www.domain.com/ccount12/click.php?id='; break;
This will now use your PHP redirection script to cloak links (obviously you change domain.com to your domain :-)).
You could use almost any PHP redirection script that outputs a unique id/code
Note: there are multiple examples I’ve used starting “case” etc…. like “case ‘testing2’: theURL = ‘http://www…..” each line can be changed to your needs, I’ve used tests2, testing, testing2 and outboundz. You can change them to use your redirection scripts. If you are using the inline js option edit the links.php file instead, there’s only the case ‘outboundz’: theURL…. line.
Log into the PHP Redirection Script and add a link, it should be given ID = 1 so will go to the link:
http://www.domain.com/ccount12/click.php?id=1
We use this code to incorporate this link into a WordPress post or page:
<span class="affst" title="outboundz" id="1">Anchor Text of Link</span>
When you create a second cloaked link it will be ID = 2 so change the id=”1″ to id=”2″ and so on.
In this way you can have as many cloaked links as you have IDs with this script.
This concept will work with pretty much any redirection script. If you have a script that generates URLs like
http://www.domain.com/UNIQUECODE1
You add
case 'testing': theURL = 'http://www.domain.com/'; break;
To the links.js file (or links.php file is using the inline js option) and build your link code like:
<span class="affst" title="testing" id="UNIQUECODE1">Anchor Text of Link</span>
Already used more than one PHP redirection script, not a problem you can add more than one type of link format. To use the two examples above, in your links.js file (note the second line uses testing2 instead of testing, each line needs a unique string (can be almost anything)):
case 'testing': theURL = 'http://www.domain.com/ccount12/click.php?id='; break; case 'testing2': theURL = 'http://www.domain.com/'; break;
Now link code
<span class="affst" title="testing" id="1">Anchor Text of Link</span>
Will use the top format (testing) and
<span class="affst" title="testing2" id="UNIQUECODE1">Anchor Text of Link</span>
Will use the bottom format (testing2).
Automation of Link Cloaking
Want a bit of automation in your link cloaking so you aren’t endlessly copying and pasting IDs etc… Not a problem.
I’ve been using this technique on affiliate sites with thousands of links and cloak the lot with a simple technique.
I’ve created a small number of affiliate sites using Shareasale datafeeds and use a simple PHP redirection script to cloak the links with format:
http://www.domain.com/buy-now.php?id=##
Create a file called buy-now.php (you can name it anything you like as long as you change relevant parts below to match the filename) and put it in the root of your domain (can put it anywhere, but easier for me to explain if it’s in the root :-))
<?php $id=$_GET['id']; header('Location: http://www.shareasale.com/m-pr.cfm?merchantID=SHAREASALEMERCHANTID&userID=YOURSHAREASALEID&productID='.$id); ?>
Replace
SHAREASALEMERCHANTID : you get this from the datafeed
and
YOURSHAREASALEID : that’s your Shareasale User ID
Add this to your Stallion links.js file:
case 'tests4': theURL = 'http://www.domain.com/buy-now.php?id='; break;
And use the link format:
<span class="affst" title="tests4" id="UNIQUEPRODUCTID">Buy Now</span>
UNIQUEPRODUCTID : is the Unique product ID from the Shareasale datafeed.
Your affiliate links will now look like this when hovered over:
http://www.domain.com/buy-now.php?id=123456
When building the site (normally with a database import script like WPRobot) you would use the above link code format instead of a normal affiliate link, in this way it’s all automated. Some of my sites where built before I used this technique, I edited the MySQL database (ran a few SQL queries) to search and replace the original affiliate links with nofollow links to the sort of code above (will explain how in a comment when I have the time).
I’d link to an affiliate site that uses this technique, but it’s never a good idea to show your affiliate sites around as makes it easier for Google to find and downgrade them (Google hates affiliate sites).
You can use the concept on any affiliate source that uses a general format with a unique code to identify each product like “http:www.ALLLINKSHAVETHISBIT?ID=UNIQUETOEACHPRODUCT”. You put the link part that’s the same for all products into the redirection script (for most Sharesale datafeeds it’s “http://www.shareasale.com/m-pr.cfm?merchantID=SHAREASALEMERCHANTID&userID=YOURSHAREASALEID&productID=”) and the unique product ID into the link code.
It’s taken me years to pull these techniques together and you get it as part of Stallion, I would have paid thousands for these techniques 5+ years ago, they protect so much link benefit and make it harder for search engines to find and downgrade affiliate sites. Now all I need is to find the time to actually build affiliate sites :-)
David Law
Cloaking Affiliate Links
Okay Okay my head is swimming. I have been following you on this subject ….only after following the “all in one seo” bantor, and just erased a paragraph and will replace it with -WOW!
The real reason I am here is to clarify: Cloaking should be done for affiliate sites only, true? (So as not to ruffle google feathers). So my internal links and my links to other sites that are not affiliate sites can be left alone correct? I am asking because if a bot catches a link to another site, did i just send it away to not return and finish the crawling of my own site? Does the bot follow all internal links out or just take it into consideration and continue within my own site? Sorry if this sounds silly but a girls gotta know these things! :) Thanks for taking the time.
SueBee
Cloaking Affiliate Links
Which Links Should I Cloak?
The short answer is cloak any links you don’t want to send SEO benefit to.
For me that includes all affiliate links.
Does not include any links to my own sites (unless there’s a reason I don’t want two of my sites linked together).
Does not include links generally.
I wouldn’t worry about the Googlebot leaving your site, even if your site had no links off the domain when it’s spidered enough pages it will leave anyway and will be back at regular intervals: more incoming links you have from other indexed pages more often you’ll be spidered.
How many pages a bot will spider at a particular time seems random, the links it follows are random, so it won’t hit your home page and follow every link on the page until it runs out. Bots act like a random link clicker, hit page A and randomly click a link, over time all links are clicked.
This is why there’s an SEO Myth Google won’t follow more than 100 links from a page, the reality is Google advises not to have more than 100 links from a page because each link (on page with 100 links) has a 1 in 100 chance of being followed every time a spider hits a page.
If you have a page with 1,000 links it’s going to take a LONG time for all 1,000 links to be followed randomly and if on that page there’s a link to an important page you really want indexing and it has links from no or few other pages it might never be indexed.
Best advice on the number of links per page is it depends on the site and how many other sites link into that site (and how popular the pages are the incoming links are from). More incoming links you have more often a bot will find your site and more links it will follow within your site.
You can submit an XML sitemap to Google, but I don’t see the point, if Google can’t find the pages of your site naturally via incoming links it isn’t going to rank them well because you’ve added an XML sitemap of everything. I personally don’t want Google to find a page via an XML sitemap, if I think I’ve done everything right and a page isn’t indexed through random spidering I want to know, having it indexed via an XML sitemap means I might not realise there’s a problem. If an important page isn’t being spidered regularly it’s easily solved (when I know there’s an issue), add more links directly to that page. Remember getting a page indexed is a waste of time if it doesn’t also generate traffic.
Well, that comment went all over the place :-)
David
Which Links Should I Cloak?
Affiliate Links - Cloaking - robot.txt
Gotcha and Thank you. As I pondered my day away on the many websites and the many new things learned and in need of rectifying on those sites, it brought me to this question: I have been misinformed on what my robot.txt file should be blocking or not blocking. This is the crux of my problem at present. So if this isnt prying, just what should be on the robot file? admin info I assume and what needs to be there if we dont want crawl errors?
Should everything on robot be transformed to be cloaked instead of blocked or is this as you said above – and no you dont have to repeat yourself from above – I got you :) – but you can see how my mind would wander to the aspects of robot.txt, yes?
Affiliate Links - Cloaking - robot.txt
WordPress Blogs and the robots.txt file
The robots.txt file is about blocking and allowing access to bots to specific parts of a site. Not the same as cloaking links.
Generally speaking most entries within a robots.txt file are a waste of time. The default action is allow spidering, telling a bot it can spider something it would have spidered anyway, is a waste of time.
Most directories and files you added to your robots.txt file is a waste of time and one is potentially damaging:
Do you use the default setup of having images under /wp-content/ ? If so you are blocking their spidering via
User-agent: *
Disallow: /wp-content/
You allow spidering of the uploads folder to Googlebot, but what about Bing and other search engines?
If you ever add a stand alone file with extension .php, won’t be spidered.
Personally as a user with about 70 WordPress sites I don’t really use a robots.txt file, mine includes this:
User-Agent: *
Crawl-Delay: 20
Which slows down spidering for some bots (Googlebot ignores it). I’ve had problems with too many bots spidering the hell out of my sites and it causing resource issues on the server, if a few spiders slow their crawl rate might help a bit. Only use if you have an issue (I have a lot of links to my sites which means spiders pretty much take up permanent residence on my servers).
That’s the entire contents of 95% of my sites (100 domains) robots.txt files.
If some admin files are being indexed or you want other parts of a site not indexed without wasting link benefit see Stallion WordPress SEO Plugin.
David
WordPress Blogs and the robots.txt file
WordPress SEO Support
Thanks David! I am already moving everything slowly to your Stallion theme and am using the plug-in where I havent had time for Theme change. And thanks for all your help today!
PHP Redirection Script
Hi David,
I’m trying to use the PHP Simple Script, but when I hover over the link I see this
## http://mydomain.com/#1 [notice the #1] ##
but if I click on the link created by PHP Redirection Script
## http://www.mydomain.com/ccount/click.php?id=1 ##
it works fine
I’m using the same title=tests2 as used in the test.js file
Any hits?
Thanks
Cloaking Affiliate Links Tutorial
Sounds like you’ve made a mistake in the code, no idea what without seeing the code used in the test.js file and a link.
URL to the site this is on?
David
WordPress Cloak Affiliate Links
Hi David,
sorry for not replying before but I wanted to test it with the latest version of Stallion. I realized the blog where I’m having issues with is running Stallion v6.0 (so I think it’s not worthy digging deeper). I’ll upgrade soon.
I was able to change the default installation, and you can see it here
When I hover over the links (Programa para ver un video en menos tiempo & Programa para ver un video más lentamente) , (sorry they are in Spanish – let me know if you want me to change them) I notice the link looks cloaked, but it is the same when I entered the links in this format:
In other words, I do not see the difference when I use any way:
this:
or this:
Programa para ver un video en menos tiempo
which leads me to think… is there a way to “audit” my sites and check if I’m wasting any link benefit?
Thanks
Héctor
WordPress Cloak Affiliate Links
Cloak Affiliate Links Guide
I can confirm the Stallion cloaked links are setup correctly. They are meant to look and act like normal text links until you view source.
The way to check is to view source, I tend to use Firefox for browsing and found an interesting anomaly when viewing source the ‘quick’ way.
The quick way is selecting the text/link etc… you want to view source followed by right-click and “View Selection Source” which pops up a window with just the content you want to check.
With the link cloaking script which uses javascript which is apparently not loaded correctly on the “View Selection Source” pop up you get a messed up text link/cloaked link: I spent about 2 hours trying to figure out what I’d done wrong code wise when I added cloaking to Stallion when the code was spot on :-)
So to view source use the not so quick way, don’t select anything on the page and right-click followed by “View Page Source” which pops up the entire pages code (and loads te javascript correctly).
You can achieve similar in IE and Chrome etc…
If you see the code like
and in the browser with javascript turned on you see a normal text link it worked.
Also clicking the link will open the link in a new window.
Since the javascript code is loaded at the bottom of the page code wise there can also be short delay before the text of the cloaked links is converted into a text link on the fly by the javascript.
I see you are using the Yoast WordPress SEO Plugin with some damaging SEO settings, your category links are nofollow. Nofollow deletes link benefit, if you plan to use a WordPress SEO plugin don’t use the nofollow or noindex settings. Also the Yoast plugin if the canonical URL feature is used breaks the Stallion SEO Super Comments pages, it adds a canonical URL back to the original post the comment is from which means Google doesn’t index the SEO Super Comments post! This will be true for any plugin that disables the WordPress canonical URLs and adds their own.
In Stallion 6.3 (next update, working on it now) I’ve added the All In One SEO Pack Plugin code directly into Stallion with major improvements, it takes Stallion SEO to another level. Since it uses the All In One SEO Pack Plugin code, Stallion will use that plugins settings related to titles etc… for specific posts. Not looked into this yet, but as I understand it there’s plugins for moving data from various WordPress SEO plugins (like Yoast WordPress SEO) and other themes into All In One SEO so they should work for Stallion’s All In One SEO basic settings.
I’ve stopped adding new features to Stallion 6.3 and working on debugging the new and some old code, so the update should be live soon.
David
Cloak Affiliate Links Guide
Tracking Clicked Links
Hi David,
I wonder if you could please give me some ideas:
There is a local business that’s interested in my blog for promoting his business.
How could I use stallion (or any other piece of software) for tracking visitors to the local business from my site? But, there is a caviat:
– how do I demonstrate and show the local business the visitor came from my blog?
– how could I track the local business conversions from readers coming from my site?
Thanks a lot
Héctor
Tracking Clicked Links
Tracking Links WordPress Plugin
The script I mention above counts the number of clicks, but it wouldn’t provide that information to your customer or track conversions.
Beyond the above Stallion doesn’t track clicks etc… I’d look for a WordPress tracking links plugin. I doubt you’ll find a plugin that tracks conversions on the site you link to though, that’s down to the site owner to track and provide the info.
What you are basically looking for is an affiliate program like Clickbank or Amazon where their system tracks everything so you and they know the information is accurate. Not really what you are looking for though.
David
Tracking Links WordPress Plugin
Affiliate Program
Hi David,
yes, it seems that what I need is to get the local business into an affiliate program…
Thanks
Héctor
How to Cloak Your Affiliate Links?
Hi,
I’ve Checked all of the Cloak Affiliate Links buttons to “ON” on the SEO page of the Stallion Theme, but the affiliate links are still visible. I’ve looked at the how to cloak affiliate links tutorial several times over the last few days. I believe I’m doing things right. I must be missing something, but don’t know what.
Also, I’m using WP Robot and have the SEO for that running as well.
Thank you for your help,
Rachel
How to Cloak Your Affiliate Links?
Affiliate Link Cloaking
Checked your website and the cloak script appears to be working as expected on the affiliate links with rel=”nofollow” attributes added by WPRobot.
The links that lack nofollow attributes won’t be converted to cloaked links. This will happen if a WPRobot module or one of your WPRobot templates isn’t adding a nofollow attribute to all affiliate links.
Unfortunately since WPRobot plugin content to WordPress is just another WordPress post there’s no way for Stallion to know if a link within a WPRobot autoblogged post is affiliate or a link you’ve added to a ‘normal’ WordPress post: you don’t want all links sitewide cloaked!
The assumption is if a link is rel=”nofollow” it’s either an affiliate link (cloak it), a link added to a comment by a user (maybe SPAM: cloak it: there’s a Stallion option to remove nofollow from comments, basically have a do follow blog) or you’ve manually added a rel=”nofollow” to a link in a normal post (or comment) and want it clocked by Stallion.
David
Affiliate Link Cloaking
Link Cloaking
Hi David,
Thanks for the clarification on link cloaking. I knew I had to be missing something.
Thanks again,
Rachel
Affiliate Cloaking Links
My site has 102 posts and 24 pages that I just installed Stallion Responsive on. Do you recommend going back into each post / page and using the ‘insert’ text from above to cloak the links or is there a simpler method?
Is this cloaking automated in Stallion Responsive? If so, where? I do not have Massive Passive Profits Plugin or WPRobot Plugin installed. Do you recommend installing these on my site and if so, why explicitly?
Thanks – I am loving Stallion Responsive.
Susanne
Affiliate Cloaking Links
WordPress Affiliate Link Cloaking
I think you’ve misunderstood the Stallion link cloaking feature which is turned on under “SEO Advanced Options” : “Cloak Affiliate Links ON”.
If you have a WordPress site which links to affiliate products you don’t really want to waste valuable link benefit linking to places like Amazon. When you add a link to an Amazon affiliate product for example you can use the Stallion link cloaking technique.
So no you wouldn’t change all links to use the Stallion link cloaking code, only links to affiliate sites or links you want Google not to consider a link like links added by your commenters to comments (do you want Google to count links you haven’t vetted added by commenters?). there’s some options under the “Cloak Links” settings on the “SEO Advanced Options” page.
If you have sites promoting affiliate products it can be automated if all the links use the same format, though based on your questions it’s going to beyond your level of understanding since it requires some SQL search and replaces that are easy to get wrong. That being said if all your affiliate links are currently nofollow (include the rel=”nofollow” tag, which tends to be the case) Stallion will automatically cloak them (cloaks all nofollow links when “Cloak Affiliate Links ON” is ticked).
Another use might be if you are giving a service a bad review, you want to link to the service so your visitors can go see how bad it is, but you don’t want to give Google an indication you think the site is valuable **
** Google uses backlinks as a vote for a webpage, when you link to a website you are saying to Google this is a good website and should be ranked higher even when you are giving the site a bad review. A link from a bad review gives the site linked to a boost in Google!!!
The Massive Passive Profits Plugin (autoblog plugin) is pretty much dead, so I wouldn’t use it (still have customers who use it, so I support it via Stallion Responsive).
WP Robot is a very good autoblog plugin (best there is), it can automatically add content including affiliate content from places like Amazon to a WordPress blog and I’ve added features to Stallion Responsive to support WP Robot users (a LOT of autobloggers use Stallion).
See my WP Robot Review (I have Stallion cloaked links on that review page), do NOT install WPRobot on an important domain, always assume Google will penalize any domain you are using an autoblog plugin on long term. If you use WPRobot to autoblog it’s a case of using throw away domains, you expect to get them banned long term and when they are you throw them away and move on (build more autoblogs).
It’s really easy to create autoblogs, not so easy to generate a lot of traffic to them since Google hates them. I don’t like the throwaway domain concept so only use autoblogs for testing, see if I can find ways around Google downgrading them (it’s an SEO challenge) rather than to make money from them per se. I make money from autoblogs, but don’t care about the money, it’s the challenge and so far Google is winning tends to find 90% of autoblogs within a few years.
As a new Stallion Responsive user after you get past the basic SEO options I recommend concentrating on the keyphrases added by editing your current and new posts. The Stallion keyphrases (All In One SEO Title and Keyphrase 1 to Keyphrase 4) are extremely important, used by multiple SEO features. With over 100 posts you have a lot of work to add the keyphrases, use tools like Google AdWords Keyword Planner for performing keyword research to determine what keyphrases to use to gain maximum traffic for each post (it’s a lot of work).
The link cloaking post for example has these keyphrases:
WordPress Title: WordPress Cloak Affiliate Links Tutorial
All In One SEO Title: Cloak Affiliate Links Tutorial
Keyphrase 1: Cloak Affiliate Links
Keyphrase 2: WordPress Cloak Affiliate Links
Keyphrase 3: WordPress Cloak Links
Keyphrase 4: Cloak Links Tutorial
I have the number 1 Google spot for several of them. I wouldn’t have the variety of SERPs without the supporting keyphrases, they are really important to my SEO strategy. This site has over 200 posts, took months to add the keyphrases to older articles.
David
WordPress Affiliate Link Cloaking
google does read javascript
Interesting read, but these days google does read javascript. Only if the script is too complex it can’t figure out what goes on. Read http://googlewebmastercentral.blogspot.nl/2014/05/understanding-web-pages-better.html and also check this page in google cache to see it shows the hidden links. I did read google does not see ajax content loaded via a click or similar event, so that may be the way to go: load script after a click (or trigger one?) and prevent google from reading it (robots.txt?)
google does read javascript