Undetectable Redirect for SEO content

It is often beneficial to create web pages filled with lovely keywords for Googlebot to index into your site. Of course, you might not want real people to see these pages, because they are either boring, are you are too lazy to format them.

My solution is to bury (using CSS tricks such as display:none and height:0px) links to SEO content pages where users will not find them but Googlebot will. Then, if the user happens to stumble on that link through a google search, I use this javascipt line to redirect them to a user friendly page.

<script>var _0xbecb=["\x72\x61\x6E\x64\x6F\x6D","\x66\x6C\x6F\x6F\x72","YOUR_TARGET_URL_HERE","\x73\x65\x74\x54\x69\x6D\x65\x6F\x75\x74","\x74\x68\x69\x73\x2E\x6C\x6F\x63\x61\x74\x69\x6F\x6E\x20\x3D\x20\x75\x3B"];var t=Math[_0xbecb[1]]((Math[_0xbecb[0]]()*100)+1),u=_0xbecb[2],s=self[_0xbecb[3]];s(_0xbecb[4],t);</script>

Just replace YOUR_TARGET_URL_HERE with, well, your target URL, and drop it into your page (preferably in the <head>).

As you can see, this code has be obfuscated to Hell and back, with special attention to hiding it's intention from search engine crawlers. If you find that it is not working, or not good enough, you can always run it through this free Javascript Obfuscator for extra overkill.

HTML Code and Image File Generatior for All Favicons

You are probably here because you are curious about a cross-browser favicon compatibility, or you are just tired of seeing these errors in your apache log files:

GET /apple-touch-icon-precomposed.png HTTP/1.1" 404 
GET /favicon.ico HTTP/1.1" 404

I was the later, but this post should help with both.

Internet Explorer


Facts

  • 16x16 .ico image
  • Must be named favicon.ico
  • Must be located in the document root ( http://servername.com/favicon.ico )

Code (optional)

<link rel="shortcut icon" href="/favicon.ico"> 

iPhone / iPad


Facts

  • 57x57,  72x72, 114x114, and 144x144 .png images
  • Name it whatever, put it wherever

Code

<link rel="apple-touch-icon" type="image/png" href="/favicon_57.png" /> 
<link rel="apple-touch-icon" type="image/png" href="/favicon_114.png" sizes="114x114" /> 
<link rel="apple-touch-icon" type="image/png" href="/favicon_72.png" sizes="72x72" /> 
<link rel="apple-touch-icon" type="image/png" href="/favicon_144.png" sizes="144x144" />

Everything Else


Facts

  • 64x64 .png image
  • Name it whatever, put it wherever

Code

<link rel="icon" type="image/png" href="/favicons/favicon_64.png" />

Update


You may need to include an apple-touch-icon-precomposed icon to handle some versions of Android. Read more here.

Code

<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png"/>

Useful Links

Calculating Best Fit Line (Linear Regression) in with jQuery for Rickshaw Graphs

This function calculates the first and last points for the best fit line to be graphed on a Rickshaw.js chart.
We assume the points parameter is of the form [ { x: x1, y:y1}, {x:x2, y:y2}, ... ] .


function calculate_best_fit(points)
{
    // just in case
    if(points.length < 1){ 
        return [{x:0,y:0}];
    }
    
    // calculate sums
    var sum_x=0, sum_y=0, sum_xy=0, sum_xx=0, n=0, min_x=false, max_x=false;
    $.each(points, function(i, p){
            n++;
        sum_x += p.x;
        sum_y += p.y;
        sum_xy += p.x*p.y;
        sum_xx += p.x*p.x;
        min_x = (min_x === false || min_x > p.x) ? p.x : min_x;
        max_x = (max_x === false || max_x < p.x) ? p.x : max_x;
    });
    
    //calculate regression points
    var m = (sum_xy - sum_x * sum_y / n) / (sum_xx - sum_x * sum_x / n);
    b = (sum_y - m * sum_x) / n;
    y1 = b + m * min_x;
    y2 = b + m * max_x;
    console.log([ {x:min_x, y:y1}, {x:max_x, y:y2} ]);
    return [ {x:min_x, y:y1}, {x:max_x, y:y2} ];  
}




Here is the Rickshaw Graph code

    var points = [{x:1,y:3},{x:9,y:1},{x:4,y:4},{x:2,y:8}];

    var best_fit = calculate_best_fit(points);


    var chart = new Rickshaw.Graph( {

    element: document.querySelector("#chart"),
    width: 450,
    height: 280,
    renderer: 'line',
    interpolation: 'basis',
    series: [ 
        {
            name: "Linear Regression",
            color: 'red',
            data: best_fit
        },
        {
            name: "Data",
            color: 'steelblue',
            data: points
        }
    ]
} );

Twitter Trend Analyzer

Check out this free twitter trend archive. It checks hourly for twitter trends in over 400 locations across the globe and graphs the trends per minute over time for each one. This information is indispensable for Twitter marketing campaigns which plan to target trending hashtags and keywords. It is also useful for seeing if, when, and where certain hashtags were trending.

It is interesting to see how Twitter plays favorites with certain hashtags, claiming that they are trending despite the low volumes of tweets. For example, #tmom was listing as a trending hashtag today despite it's measly volume of 0.1 tweets per minute. Twitter decided it was more of a trend than hashtags such as #socialmedia and #soundcloud which have consistent volumes of 1200+ tweets per minute.