Showing posts with label web development. Show all posts
Showing posts with label web development. Show all posts

Wednesday, 4 May 2011

Google Analytics easy-peasy-lemon-squeezy

Clever chaps & chapesses at Google. I've just put a website live for an Accountancy Outsourcing Company www.henryjamesoutsourcing.co.uk and added Google Analytics to the site.

Google Analytics is one of a number of tools Google provide for web developers. Essentially it captures statistics for pages on your web site. You have to have a Google account to use it so you have to sign up there first. Then you add Analytics to your suit of Google tools (sign up for an email address whilst you're at it and you can receive your stats reports pushed via email to the google email address)

Once you've signed up you'll get a little text window with some Java script in that'll look a bit like this

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try{
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {}
</script>

Copy this and paste it into your static web pages eg index.html … before the tag (keeps things tidy) and that's it hit your site a few times and check your Analytics pages a bit later (takes a while for the stats to filter through) I hit the verify

Now for some techie stuff: This is downloading some javascript code from google that actually does the monitoring. It uses cross site scripting to do this but adding the javascript dynamically

document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));

gets round the browser security issues (see my earlier posts on cross site scripting and Ajax) Activity is reported back to google in most cases. One thing to watch out for is that any activity from China won't be reported on in full because of Chinese Government security limitations on internet information. Not that that's a problem for Henry James Outsourcing, maybe for when we're a little nearer world domination.

Monday, 18 January 2010

SEO - The Dark Art

Search Engine Optimisation - a strange and dark world occupied by people with street cred. games consoles and skateboards. I was contacted recently by a company I did some work for because searching for their name and one of their customer's brought up all the usual sites in google and my CV (woops!)

The CV was a pdf, and listed companies I had done work for although there was no direct link in the wording my CV obviously listed my client but also their customer mentioning no link or relationship.

I took the CV down for the sake of a quiet life, but it got me thinking why didn't my company website show up in the same search? http://www.cwebster-consulting.co.uk/. This in turn started me thinking about SEO (Search Engine Optimisation), something I'd not done for a long time. It dawned on me that the last time I did anything along those lines was way back when, all you had to do was drop in the key words in the meta tag and send a cheque off to your favourite search provider!

Now though, it seems things have changed. I'm reliably informed there are “White Hat” strategies that can get you to the top of the list. There are “Black Hat” strategies that can also get you there but can also get you barred from search engines altogether. You're best going to an SEO specialist Dave Chung is one SEO Guru who can help you to get your site a more appropriate audience.

So what strategy did I use to get my CV up there in the rankings? Well, none what so ever. It was a pdf, so there was no code. There were no links (I'm not that great at creating pdf's) it was just a CV exported from Word to pdf format. It did for some reason though, satisfy whatever criteria Google use to rank web pages. I can only assume that this is simply what's in the text.

I did a little more digging and came up with Google’s rules on getting good page ranking. Some interesting things come up. For example, every web page has a reputation. Websites with a good reputation linking to other well behaved websites improve their page rankings. So don't link to iffy websites and do link to legit, nice websites and let them link to you. One of the “Black Hat” strategies is to set up a company and charge people for links to bump up their ranking. Be careful, though, if discovered this can get you banned from some sites including Google.

Nice sites that show meaningful error messages (401, 403, 404, 500 errors) instead of the default pages churned out from standard web servers rank higher. So customise your error messages and give links back to the main pages in your site from the error pages.

Only three things matter on websites, content, content, content. For your site to bump up its rankings you need to publish articles that are relevant to your business. Use Title text as though it were key word searchable. Google like to use titles as guides to what's on the site. So for example if you’re a plumber you should add an article every month on Plumbing, Plumbing techniques, Plumbing products, maybe review some equipment. This will aid the search engines indexing of your site for relevant key words in the search criteria.

Finally update regularly, most search engines throw relevance into the mix by returning sites that are regularly updated and maintained. This shows a site on the move and being kept up to date. All of which adds to relevance.

Wednesday, 18 June 2008

Ext Javascript tools

I've always avoided using javascript. I truely hate javascript. Having said that I recenlty found myself having to add a tabbed section to a web page and I really could not be bothered to mess about. So I turned to Ext javascript tools library. It really made a nasty job actually quite easy. I was using the TabPanel, a couple of lines of code from the very good api example got me up and running and the resulting table showed good browser compatability.

write the javascript, include the required library files and stylesheets in the html page and off you go....

Here's my create tab javascript code:

/*
* Ext JS Library 2.1
* Copyright(c) 2006-2008, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/

Ext.onReady(function(){
  // basic tabs 1, built from existing content
  var tabs = new Ext.TabPanel({
    renderTo: 'tabs1',
    width:620,
    activeTab: 0,
    frame:true,
    border:true,
    defaults:{autoHeight: true},
    items:[
      {contentEl:'tab1', title: 'Originating Number(s)'},
      {contentEl:'tab2', title: 'Recurring Charges'},
      {contentEl:'tab3', title: 'Cost Centre(s)'}
    ]]
  });


  function handleActivate(tab){
    alert(tab.title + ' was activated.');
  }
});


Then in my HTML page....

<div id="tabs1">
    <div id="tab1" class="x-hide-display">
    <p>
        tab1 text here...
    </p>
    </div>
    <div id="tab2" class="x-hide-display">
    <p>
        tab2 text here...
    </p>
    </div>
    <div id="tab3" class="x-hide-display">
    <p>
        tab3 text here...
    </p>
    </div>
</div>



Job done. comes all styled up and looks great.


You can mess with the options available in the API and take it from there.