dannytalk ™ A Danny Ng Blog

Danny Ng blogs about SEO, Web Development, Christianity, and Life in General

Archive for September, 2008

Updated: Tracking Exit Links in Google Analytics

Posted by danny On September - 27 - 2008

I’ve just updated my code on tracking exit links in Google Analytics to skip applying the code if the href of an anchor tag is ‘#’. This is usually the case when the anchor tag is there to execute javascript or to scroll to the top of the page, thus does not contain any exit liks.

This can be found on line 29 with the addition of a condition in the condition statement, anchors[i].href != (document.location + ‘#’).

I’ve seen a few other scripts that tracks exit links but some of them I don’t think are very good as they lack error checking and also some of them overwrite the existing onclick attribute which I guess could break the site’s functionality.

Also to prove to you that my script is working, I’ve included a screenshot of the report found in google analytics.

Of course you can click through to the individual links and analyse the dimensions for further analysis. I will be working on more google analytics custom scripts to help bring and enhance more meaningful reports.

Bookmark This!

http://www.dannytalk.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/sphinn_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/twitter_48.png

Javascript Cumulative Offset

Posted by danny On September - 21 - 2008

I just wrote a simple helper function that gets the cumulative offset of the x and y position (or the cumulative top and left) of an element. This function is helpful if you want to position things around a certain element.

Although I haven’t tested it extensively yet, I think it works fine so far. If there’s any bugs, please let me know.

To use it, simply call getCumulativeOffset(element).x or getCumulativeOffset(element).y. There’s also a simple helper method to get the offsetTop and offsetLeft properties by calling getOffset(element).x and getOffset(element).y.

I’m working on a feature that allows these methods to be prototypes of HTML elements so that you can call it by element.getCumulativeOffset().x instead which is more elegant and object oriented.

/**
 *  @author:    Danny Ng (http://www.dannytalk.com)
 *  @date:      21/09/08
 *  @notes:     Free to use and distribute for non-commercial use without altering this notice. Would appreciate a link back.
 */
function getCumulativeOffset(el)
{
	var x = 0;
	var y = 0;
	var cur = (el) ? el : this;
	do
	{
		if (cur.nodeName.toLowerCase != 'td')
		{
			x += cur.offsetLeft;
			y += cur.offsetTop;
		}
	}
	while ((cur = cur.offsetParent) && cur.nodeName.toLowerCase() != 'body');	

	return { x: x, y: y };
}

function getOffset(el) { return (el) ? { x: el.offsetLeft, y: el.offsetTop } : { x: this.offsetLeft, y: this.offsetTop }; }

Bookmark This!

http://www.dannytalk.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/sphinn_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/twitter_48.png

Keyword Optimisation Really Works!

Posted by danny On September - 16 - 2008

I’ve had this domain for less than 3 months now and I’ve been testing how fast I can get in the 1st page of Google and Yahoo’s search engine results page (SERP) for the term “danny ng”.

As of today, my blog is ranked #7 on Google AU and #5 on Google US. On Yahoo AU and Yahoo US, I’m ranked #1. Not bad ay?

Next step is trying to get my PageRank up. It remains 0 at the moment. I should blog more but I’ve been a lazy bum hehe.

There’s a lot of things I want to do with javascript, but haven’t found time yet juggling a job, a girlfriend, a social life and so on.

I will probably write a post on where do you draw the line between search engine optimisation (seo) and usability in the future. Frustrates me when deciding whether to neglect usability for the sake of seo.

Google US

Yahoo US

Google AU

Yahoo AU

Bookmark This!

http://www.dannytalk.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/sphinn_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/twitter_48.png
Tags:

Eye-ball

Posted by danny On September - 13 - 2008

Yes, that’s the name of my sister’s optometry ball at university. Me and a bunch of guys from church are going to be playing music there tomorrow night. Songs included are Stars by Switchfoot, Man in the Mirror by Michael Jackson, Shiver by Maroon5 and so on.

Hopefully I’ll have pictures to post up hopefully by Sunday night.

Pretty hectic weekend though as tomorrow will be pretty much taken up by practice, setting up, playing and packing up. Might head to the gym if I do wake up early enough (it is 2.45am now :S). Then on Sunday I’ll be playing for church which means I got to wake up at 7am.

Then it starts all over again on Monday. Work work…

Bookmark This!

http://www.dannytalk.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/sphinn_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/twitter_48.png
Categories: Random

Quick Update

Posted by danny On September - 7 - 2008

So yeah, I haven’t been doing much blogging recently. Been busy meeting up with people, gyming and practicing to play at my sister’s university ball.

On top of that, I might start doing some Joomla web development for some clients and even look into doing some e-commerce for myself. Also I want to work on more javascript widgets that will be cool to use.

I’ve added a contact page for people who wish to contact me. I’m using cforms plugin which seems to be pretty advanced in functionality, but also a bit hard to use. Takes a bit of reading.

So many things to do, so little time.

8 Praise our God, O peoples,
let the sound of his praise be heard;

9 he has preserved our lives
and kept our feet from slipping.

10 For you, O God, tested us;
you refined us like silver.

11 You brought us into prison
and laid burdens on our backs.

12 You let men ride over our heads;
we went through fire and water,
but you brought us to a place of abundance.

13 I will come to your temple with burnt offerings
and fulfill my vows to you-

14 vows my lips promised and my mouth spoke
when I was in trouble.

15 I will sacrifice fat animals to you
and an offering of rams;
I will offer bulls and goats.
Selah

16 Come and listen, all you who fear God;
let me tell you what he has done for me.

17 I cried out to him with my mouth;
his praise was on my tongue.

18 If I had cherished sin in my heart,
the Lord would not have listened;

19 but God has surely listened
and heard my voice in prayer.

20 Praise be to God,
who has not rejected my prayer
or withheld his love from me!

- Psalm 68:8-20, Biblegateway

Bookmark This!

http://www.dannytalk.com/wp-content/plugins/sociofluid/images/digg_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/reddit_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/delicious_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/furl_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/newsvine_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/technorati_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/google_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/myspace_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/facebook_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/sphinn_48.png http://www.dannytalk.com/wp-content/plugins/sociofluid/images/twitter_48.png
Categories: Random