mhinze.com

links etc.




    Archive for the 'SEO' Category

    Hiding Affiliate Links Switcheroo

    Wednesday, April 18th, 2007

    michael gray posted an article about hiding affiliate links, but the best tip was in the first comment.

    Link out to the real site in your static link (use nofollow if you want), then use a javascript onload function to replace the links on the fly with the affiliate ones (and even remove the nofollow, if you want to trick the nofollow-highlighers).

    Without javascript it is just recommending the official site. With javascript it’s an affiliate site. Sure you might lose the 18 non-javascript users, but the others will use the affiliate links (check your logs for the numbers). Just make sure to test it across the standard browsers (check your logs).

    not a bad idea at all.  here's the proof of concept in javascript. 

    here i apply an additional class to each link that describes the affiliate link to use.  in the POC i create two arrays: one for the class names and the other for the links.  i would use a server side technology for the production task of filling these arrays.

    also i would use a 301 redirect on the server instead of including my affiliate links anywhere that people or robots can see them.

    i'm using this great getElementsByClassName because it supports multiple classes on your anchor elements.

     

    <a class="lendingtree otherclass" rel="nofollow" href="http://www.lendingtree.com">
    Here is an affiliate link</a>.
    And <a class="myfico otherclass" rel="nofollow" href="http://www.myfico.com">
    here's another one</a>.
    <script type="text/javascript">
    function getElementsByClassName(strClass, strTag, objContElm) {
        strTag = strTag || "*";
        objContElm = objContElm || document;
        var objColl = objContElm.getElementsByTagName(strTag);
        if (!objColl.length &&  strTag == "*" &&  objContElm.all) objColl = objContElm.all;
        var arr = new Array();
        var delim = strClass.indexOf('|') != -1  ? '|' : ' ';
        var arrClass = strClass.split(delim);
        for (var i = 0, j = objColl.length; i < j; i++) {
            var arrObjClass = objColl[i].className.split(' ');
            if (delim == ' ' && arrClass.length > arrObjClass.length)
                continue;
            var c = 0;
            comparisonLoop:
                for (var k = 0, l = arrObjClass.length; k < l; k++) {
                    for (var m = 0, n = arrClass.length; m < n; m++) {
                        if (arrClass[m] == arrObjClass[k]) c++;
                        if (( delim == '|' && c == 1) || (delim == ' ' && c == arrClass.length)) {
                            arr.push(objColl[i]);
                            break comparisonLoop;
                        }
                    }
                }
        }
        return arr;
    }
    // To cover IE 5.0's lack of the push method
    Array.prototype.push = function(value) {
      this[this.length] = value;
    }
    
    // array of classes and links - they need to match up
    var classes = new Array("lendingtree", "myfico");
    var afflinks = new Array("http://example.com?x=123123&y=1123123", "http://example.com?z=asdk#ikjlk");
    
    // for every affiliate link class
    for (var i = 0; i < classes.length; i++) {
    // get the anchor elements that have that class
        var links = getElementsByClassName(classes[i],"a",document);
    // for every anchor (a)
        for (var j = 0; j < links.length; j++) {
    // set the href to our corresponding affiliate link
            links[j].href = afflinks[i];
    // clear the rel attribute
            links[j].rel = "";
        }
    }
    </script>

     

     

    Technorati tags:

    wordpress seo stuff

    Friday, March 30th, 2007

    doing a little seo for wordpress this morning.

    for my sites, duplicate content has become a large seo problem.  i am fixing it today.

    In an attempt to eliminate duplicate content from this and other wordpress blogs i maintain, I have done the following:

    in an attempt to clean up my dirty meta descriptions, i installed head meta description plugin

    i was already doing

    • spiffy title tags:
    <title><?php if (is_home()) { ?><?php bloginfo('name'); ?><?php } else { ?><?php wp_title(''); ?> &raquo; <?php bloginfo('name'); ?><?php } ?></title> 
    • google sitemaps generator (actually this is the link for the new beta which i haven't played with yet)
    • my permalink slug is almost always
      /%postname%/

    and this isn't necessarily seo, but i am using dofollow on a few blogs (including this one)

    all this plus the regular advice regarding proper markup and decent content and not breaking the rules should increase my blogs' organic traffic

     

     

    Technorati tags: ,

    pinging technorati technique, code

    Tuesday, February 27th, 2007

    the technique: trick to increase technorati rank

    the output:

    C:\\>type c:\\urls.txt
    http://www.testerson.com|Testerson
    http://www.testertown.com|Testertown
    C:\\>XmlrpcPing.exe c:\\urls.txt
    Success: http://www.testerson.com
    Success: http://www.testertown.com
    
    C:\\>XmlrpcPing.exe c:\\urls.txt
    Failed: http://www.testerson.com You just sent a ping, please only ping when you update
    Failed: http://www.testertown.com You just sent a ping, please only ping when you update
    



    the quick & dirty c# code to repeatedly xmlrpc ping technorati (some heavy lifting here)

    [csharp]
    class Program
    {
    static void Main(string[] args)
    {
    if (args[0] != null)
    {
    string url, name, output;
    string[] urlnames = File.ReadAllLines(args[0]);
    foreach (string urlname in urlnames)
    {
    url = urlname.Split('|')[0];
    name = urlname.Split('|')[1];
    if (Send("http://rpc.technorati.com/rpc/ping", name, url, out output))
    Console.WriteLine("Success: {0}", url);
    else Console.WriteLine("Failed: {0} {1}", url, output);
    }
    }
    }

    public static bool Send(string pingUrl, string name, string url, out string output)
    {
    try
    {
    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(pingUrl);
    request.Method = "POST";
    request.ContentType = "text/xml";
    Stream pingstream = (Stream)request.GetRequestStream();
    XmlTextWriter xtw = new XmlTextWriter(pingstream, Encoding.UTF8);
    xtw.WriteStartDocument();
    xtw.WriteStartElement("methodCall");
    xtw.WriteElementString("methodName", "weblogUpdates.ping");
    xtw.WriteStartElement("params");
    xtw.WriteStartElement("param");
    xtw.WriteElementString("value", name);
    xtw.WriteEndElement();
    xtw.WriteStartElement("param");
    xtw.WriteElementString("value", url);
    xtw.WriteEndElement();
    xtw.WriteEndElement();
    xtw.WriteEndElement();
    xtw.Close();
    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    StreamReader respSr = new StreamReader(response.GetResponseStream());
    XmlDocument xml = new XmlDocument();
    string pingResponseXml = respSr.ReadToEnd();
    xml.LoadXml(pingResponseXml);
    respSr.Close();
    response.Close();
    output = xml.SelectSingleNode("methodResponse/params/param/value/struct/member[2]/value").InnerText;
    return "0" == xml.SelectSingleNode("methodResponse/params/param/value/struct/member[1]/value/boolean").InnerText;
    }
    catch (Exception ex)
    {
    output = ex.Message;
    return false;
    }
    }
    }

    [/csharp]

    questions? leave a comment

    4 most important seo considerations

    Monday, February 26th, 2007

    a very short list:

    1. inbound links

    2. keywords (and related phrases) in places where keywords should go

    3. proper navigation

    4. avoid negative factors
      • participation in sketchy communities (ie, linking to "gray area" sites)
      • spam or the appearance of spam
      • etc, etc

    5. runners up:

      • site age
      • freshness
      • uniqueness
      • outbound links
      • any factor by which software can evaluate content quality: vocabulary & grammar level, length of content, similarity to other authoritative text



    © 2007 mhinze.com