Announcement

Collapse
No announcement yet.

Freebie: Forwarding Google searches to Actinic's own search

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Freebie: Forwarding Google searches to Actinic's own search

    Why?
    Sometimes, Google fails to index links deep inside your site, but your index page still comes up high for certain terms.

    The thing is, you probably don't have that item on your front page, and so if the user follows a link like this in Google to your homepage, they'll have to forage around in your site to find the thing they just searched for.

    Here is some template code that acts as a proxy, taking the google search, and sending to your internal search. If someone clicks on a link in Google, and lands on your homepage, they will be forwarded to a search for those terms. This is usually something they are looking for. I've found that it works rather well.

    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22IsBrochureHomePage%22%20%2f%3e%20%3d%3dtrue" >
    <script>
    //stupid ie compatibility 
    if (!Array.prototype.indexOf)
    {
      Array.prototype.indexOf = function(elt /*, from*/)
      {
        var len = this.length;
    
        var from = Number(arguments[1]) || 0;
        from = (from < 0)
             ? Math.ceil(from)
             : Math.floor(from);
        if (from < 0)
          from += len;
    
        for (; from < len; from++)
        {
          if (from in this &&
              this[from] === elt)
            return from;
        }
        return -1;
      };
    }
    
    
    var queryString = new Array();
    var thisurl = document.referrer
    if(thisurl.indexOf("google")!=-1){
    	var querystring = thisurl.split('?');
    	var parameters = querystring[ 1 ].split('&');
    	for (var i=0; i<parameters.length; i++) {
    	    var pos = parameters[ i ].indexOf('=');
    	    if (pos > 0) {
    	        var paramname = parameters[ i ].substring(0,pos);
    	        var paramval = parameters[ i ].substring(pos+1);
    	        queryString[ paramname ] = unescape(paramval.replace(/\+/g,' '));
    	    } else {
    	        queryString[ parameters[ i ] ]="" 
    	    }
    	}
    
    
    // blocked words, that will not trigger the search:
    var myBlocked=new Array("term1","term2","term3");
    
    if(myBlocked.indexOf(queryString[ 'q' ])==-1){
    document.location='<actinic:variable name="CgiUrl" />ss<actinic:variable name="CGIScriptIDText" />.pl?page=search&SS='+queryString[ 'q' ]+'&search=ACTION&PR=-1&TB=A';
    }
    }
    </script>
    </actinic:block>
    Insert this block into your index page, just above the </head>, or in fact, anywhere in the page.

    here is a search to try: basketball shoes. Click basketballasylum.co.uk, to see what happens.

    this is a freebie kids, and this means i cannot provide direct support for it, any updates will land right here. thx.

    changelog:
    - added support for ignored terms
    - converted the code to a template based blockif
    - added array prototype for Iexplorer support.

    comments/opinions?

    #2
    makes some interesting results, i shall be playing with this one

    Comment


      #3
      Pretty awesome stuff Gabe.

      One thing that I think would confuse a customer is when I click on the Google search result, the home page begins to load and shows for a second or two, then forwards on to the search results page.

      Perhaps it might be possible to get the script to run before the home page starts loading, speeding up the time it takes from clicking the search result to arriving on the shop search page.

      Comment


        #4
        for this to happen, you'd need to include it at the top of your primary template, in the header of your page, with a blockif, stating only to display the code on the homepage.

        Comment


          #5
          there you go ruining another fine day with these blockif's again

          Comment


            #6
            i have updated the code to support blocked words, ie. words you'd want to ignore in your incoming Google queries.

            Comment


              #7
              thanks for sorting that, the keyword kites caused me havoc

              Comment


                #8
                can anyone remember the PageType for the frontpage, so that we can build a block and make this a template addin?

                Comment


                  #9
                  There's an inbuilt condition 'IsbrochureHomePage' or something like that.

                  Comment


                    #10
                    Section Level 0 too I think

                    Army Gore-tex
                    Winter Climbing Mitts
                    webD's Blog: Website design, SEO and other ramblings…
                    Twitter LinkedIN

                    If you think a post is good, rate it!

                    Find the answers in the Knowledge Base | Have you read the User Guides

                    Comment


                      #11
                      Section Level 0 is shop top.

                      Comment


                        #12
                        IsBrochureHomePage is the condition I use.

                        Comment


                          #13
                          Originally posted by leehack View Post
                          Section Level 0 is shop top.
                          Your absolutely right Lee. Perhaps I should stop posting today, I seem to be a bit off my game

                          Army Gore-tex
                          Winter Climbing Mitts
                          webD's Blog: Website design, SEO and other ramblings…
                          Twitter LinkedIN

                          If you think a post is good, rate it!

                          Find the answers in the Knowledge Base | Have you read the User Guides

                          Comment


                            #14
                            A possible problem I can see is that google may see this technique as black hat seo. There is a black technique called a stealth redirect which presents one page to google and another to users. Google is very wary about users being directed to a different page to that which is listed in the SERPS

                            Comment


                              #15
                              this is something i'v been thinking about.

                              any ideas on how this can be done without such problems?

                              present them with a link perhaps? pre-filled in search boxes?

                              Comment

                              Working...
                              X