Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

My Google Analytics reports a bounce rate very high for outbound/javascript:void(0) but I don't understand what this URL is. I use Drupal, and in the HTML code there isn't this URL.

share|improve this question

migrated from stackoverflow.com Nov 10 '11 at 11:05

This question came from our site for professional and enthusiast programmers.

    
Can you share the URL of your site with us? –  Toby Nov 29 '11 at 0:33
add comment

1 Answer 1

javascript:void(0) is not a URL - it is a way to prevent links from direct loading any URL. Actually this attribute means 'Do Nothing'.

In most cases this is needed when the link calls a JavaScript function on the current page.

In links the href attribute is required : <a href="http://www.example.com">link</a>, but in some cases is needed link to call JavaScript function - this can be achieved with next attribute: href="javascript:SomeFunction();"

The problem is that href attribute cannot forward reference to itself to the called JavaScript function. If for example you need to change clicked link color to red and to change the link innerHTML the easiest way is to use this word as reference to the link itself: <a href="javascript:void(0)" onclick="this.style.color='red';this.innerHTML='This link';">link</a>

So current javascript:void(0) mean that your link is connected to a JavaScript call - this call can do everything - load another page, or site or any JavaScript function. You must look at your JavaScripts to find the reasons why those links affect your site bounce rate.

In Google Analytics you can try to check 'Content' > 'Events' where usually function calls are recorded, just be aware the Google Analytics Events tracking must be activated again via JavaScript on the site.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.