A Lovely Anchor Text/Domain Shuffler Script
|
| |
![]() | |
Alright. So I decided I’d pump out a script for you guys today.
Here’s the premise: You’re doing a link exchange. Or writing a wordpress plugin that will give credit back to you via link love. Or making a free wordpress template. Or a myspace layout. Or really anything. No matter what, if you’re getting mass deployed, you might want to consider having alternating link text. Essentially, the entire fix Google did to fix Google Bombs was to simply make it so any anchor text that appeared suddenly and was repeated identically, would lead to a sandbox for that keyterm. So in any mass deployment it’s best to be careful.
Beyond that, who wants to target only one section of a niche? PSHA!
This script is pretty basic, but pretty lovely.
Disclaimer: Wordpress has slaughtered my code in the past, so I’m going to link to the script at the bottom of the entry. I’ll try and paste the code here though.
How It Works:
Computers cannot create truly random numbers. So as a result, we have to give them a starting point. A “seed” number. Let’s say our seed is 4, and we generate 10 numbers. If we terminate the program, and run it again with the same seed, we will get…that’s right. The exact same numbers. So this converts the domain the script is being accessed from into a seed number. The anchor text will never change on that domain. But as soon as it’s deployed on another domain, so will the links. Sound good? I thought so.
Getting our Seed Number
function getSeed()
{
$script=$_SERVER['HTTP_HOST'];//the current domain/subdomain being accessed
$amt=0;
$script=strtolower($script);//capital letters in the domain could interfere with which link is shown w/ older webservers
for($i=0; $i < strlen($script); $i++)
{
$amt+=ord($script{$i});//convert letter to numerical value, and add
}
return($amt);
}
Loading Our Links
function getLinks()
{
$links=array();
//first, we load the first key of the second dimensiondimension of our array with the urls we want to promote
$links[0][0]="http://www.slightlyshadyseo.com";
$links[1][0]="http://www.slightlyshadyseo.com/?p=157";
//next, we pick our anchor text for these, and load it into the second tier.
//these will show up as anchor text whenever slightlyshadyseo.com is the link
$links[0][1]="Slightly Shady SEO";
$links[0][2]="SEO Blog";
$links[0][3]="Shady SEO Blog";
$links[0][4]="Blackhat Marketing";
$links[0][5]="Blackhat SEO blog";
//these will show up whenever the specific article is linked to.
$links[1][1]="Wordze Review";
$links[1][2]="Keyword Selector";
$links[1][3]="Keyword Tool";
return($links);
}
Our Main Code
$seed=getSeed();
srand($seed);//initialize the random number generator with our seed
$links=getLinks();//retrieve our array of links
$siteIndex=rand(0,sizeof($links)-1);//only examines the number in the first [#] of links[][]
$anchorText=rand(1,sizeof($links[$siteIndex])-1);//this examines the number of anchors available at location $siteindex
echo "<a href=\"".$links[$siteIndex][0]."\">".$links[$siteIndex][$anchorText]."</a>";
Not to difficult, eh? Just replace my links/anchor text with yours, and add as many as you’d like.
Any bug fixes(I can’t image how there would be) feel free to comment below.
As always, if you enjoy/use the script, I’d appreciate some link-lovin.
-XMCP
PS: This is not the magical script I’ve been working on for you guys. That one started as Javascript, turned into Javascript and PHP mixed, and from there became a Wordpress Plug-in. Base functionality is done, despite my hatred for JS. Now all I have to do is learn how to make a plugin….





















January 24th, 2008 at 4:16 pm
Nice stuff XMCP. Quick question; Is it possible to add more base links and anchor text to go with them? Here’s a snip that will better explain what I am talking about;
$links=array();
//first, we load the first key of the second dimensiondimension of our array with the urls we want to promote
$links[0][0]="http://www.acxn.net";
$links[1][0]="http://www.acxn.net";
$links[2][0]="http://www.racersengineering.com";
//next, we pick our anchor text for these, and load it into the second tier.
//these will show up as anchor text whenever slightlyshadyseo.com is the link
$links[0][1]="Slightly Shady SEO";
$links[0][2]="SEO Blog";
$links[0][3]="Shady SEO Blog";
$links[0][4]="Blackhat Marketing";
$links[0][5]="Blackhat SEO blog";
//these will show up whenever the specific article is linked to.(in this case, a wordze review)
$links[1][1]="Wordze Review";
$links[1][2]="Keyword Selector";
$links[1][3]="Keyword Tool";
//these will show up whenever the specific article is linked to.(in this case, a wordze review)
$links[2][1]="Wordze Review";
$links[2][2]="Keyword Selector";
$links[2][3]="Keyword Tool";
return($links);
Obviuiosly I haven’t changed much yet, but I think you see what I’m talking about.
Thanks for this script XMCP. Nice of you to share it.
January 24th, 2008 at 4:42 pm
Why does this post sound so much like my TextBlender v/1.0
Gotcha!
January 24th, 2008 at 5:11 pm
An interesting script, if a bit simplistic.
By the way, try the WP-Syntax plugin for auto-formatting code in your posts; it works very well on my blog.
January 24th, 2008 at 5:22 pm
Nice, I like it.
Unrelated, I have to say it’s so frustrating paging through all my feeds in feeddemon and coming across your feed as a partial. How about pushing the feed to full posts?
January 24th, 2008 at 8:34 pm
@5ubliminal: Because I’ve already SHOWN code here that worked exactly like yours, and you’ve already commented on it? And you only released yours after I released mine? Much respect buddy, but get your memory checked a bit
@W-Shadow: I’ll give it a go. What I’m using right now just so happens to use the same stylesheet as the template, so it DEFINITELY needs to change.
@Jerome: I’ll consider it. I actually thought it was on full data. However, this resists scrapers a lot more, and also allows me to keep accurate traffic stats. I gauge what topics to write about by the percentage of my RSS scubscribers that click the link.
January 24th, 2008 at 11:34 pm
Nice share XMCP. Sent a comment earlier but apparently it didn’t go through. Had some code in it so it probably got bounced.
Thanks for this.
January 25th, 2008 at 3:37 am
Interesting. One question though - wouldn’t it be far more useful if you did it on a per-page basis? I dunno, perhaps calculate the md5 of the url, then do the same thing. The result would be all of the different version of the links on the same domain.
January 25th, 2008 at 4:14 am
Umm, dude, just to simplify things a bit - you don’t need to muck around with a seed anymore, unless you’re using a pre V4.2 PHP

Its automatically randomises now
January 25th, 2008 at 6:28 am
nice. any thoughts on how to upscale that to a larger scale? after all the code works great when you have just a few sites to work with but becomes impractical when you have thousands. so far i’ve got scrape the meta keywords at build (if you have more than one that is) or two, randomize the sites keywords swinging 50% towards the main page optimized term.
January 25th, 2008 at 12:40 pm
@SellerGirl: But I want to..I want static anchor text on any given domain, so it doesn’t throw any Google red flags. Constantly changing anchor text is not my friend
@itchy: Even on a large scale, 10-20 anchor texts per domain should be more than enough to not throw the google bomb filters.
@doman: Yes, it works well like that too. I favor doing it by domain, but others can do more.
@XLSpecial: Yeah, sorry about that. Mucking around with my comment settings apparently needs to continue.
January 25th, 2008 at 1:20 pm
No worries dude.
Quick question concerning what I posted above. I set it up like shown, just changing the links and anchoir text, but for some reason it only shows the links/anchor for the first and third options. none for the second/middle one. Is it a simple fix to make this work with more links? Certainly don’t expect you to recode it or anything, just curious if it’s only a setting or two that needs to be changed.
Thanks again.
January 25th, 2008 at 10:53 pm
XMCP: “But I want to..I want static anchor text on any given domain, so it doesn’t throw any Google red flags. Constantly changing anchor text is not my friend”
Ah, thats different and an excellent reason to do it. I’ve done the same thing with different techniques - sorry, didn’t pickup on the reasoning from the description
February 1st, 2008 at 10:35 am
[…] My new favorite blogger, who’s probably younger than you: Anchor text shuffler for your link bombing box. A non-shady post on what to do if your rankings crash. And finally for […]
March 19th, 2008 at 5:02 pm
very interesting, I suspect some people might have less “ethical” uses for it, though;)