Toll Free: 1-877-695-7388

GTA: (647) 699-2838

Search Engine People
  • SEO
  • SEM
  • CRO
  • Display
  • Blog
  • Why Us
  • Contact
  • Join Our Team
  • Get A Quote

Toll Free: 1-877-695-7388

GTA: (647) 699-2838

Does Google Index OnClick Links?

Ruud Hein | June 12th, 2012
Tweet
Share7
Share
Pin
7 Shares

onclick 

Summary: yes, Google indexes onclick links.

The conditions are that the information to resolve the onclick to a URL has to be available in the HTML page; not in a linked JavaScript file. The way it resolves should be simple-ish too.

What Is An OnClick Link?

To figure out what to do when there are certain events, certain moments, browsers watch for. When you hold your mouse over something (onmouseover), when a webpage has fully loaded (onload), or when you click on something (onclick), to name a few.

A browser knows pretty darn well what to do with those events but if we want, we can use those moments, those events, to start a piece of JavaScript code; that code can than do pretty much anything we like.

The OnClick event is triggered when you hold your mouse over an element on a webpage, and click (mouse button down, mouse button up).

The OnClick event can be attached to any HTML tag. Here's an example:

  • <div onclick="alert('hey, this works!!')">content</div>

Using the OnClick moment to do something with JavaScript, we can use JavaScript functions to send the browser to another URL. Like so:

  • <div OnClick="location.href='http://example.com'">content</div>

OnClick links are often used attached to a regular link where together with some other code they can open the link in a new window or send information to an analysis script to count downloads, for example.

  • <a href="#" OnClick="location.href='http://example.com'">

Does Google Index And Count OnClick Links?

Yes.

Since 2009 Google looks for and finds OnClick links in any and all HTML tags. When found they will add the URL to their crawl.

If there is sensible "anchor" text then the text of the element will be used as anchor text.

The OnClick link also passes PageRank.

But Beware!

Google is the only one doing this so far.

Also, Google will only try to find the URL:

  • If the information is in the same HTML document
  • And if the functions to figure out what the OnClick leads to aren't too complex

Often finding yourself in a situation where you have to use an OnClick in an HTML document (as opposed to dynamically attached to it) may be the sign of programming gone wrong.

Conclusion

  • Google treats OnClick links pretty much like regular links:
  • They find them
  • They index them
  • And they pass PageRank and anchor text
  • For that to happen the OnClick event and all information needed to find out what URL it would lead to have to be available in the page
  • Having to use OnClick in an HTML document as opposed to attached to it may be a sign of a quick and dirty workaround
  • Having to use OnClick in an HTML document can Lead to usability issues

If you liked this you might enjoy Can I Have Numerical ID's In My URL Or None At All?

Tweet
Share7
Share
Pin
7 Shares
Posted in SEOTagged 101, questions, SEO

About the Author: Ruud Hein

My paid passion at Search Engine People sees me applying my passions and knowledge to a wide array of problems, ones I usually experience as challenges. People who know me know I love coffee.

Ruud Hein

One thought on “Does Google Index OnClick Links?”

  1. Giovanni Sacheli says:
    October 18, 2013 at 8:11 am

    Hello Ruud, please let me know what you mean with this “And if the functions to figure out what the OnClick leads to aren’t too complex”

Comments are closed.

Recent Posts

  • Maximizing Your E-Commerce Sales:
    A CRO Audit Guide
  • Movin’ On Up! Why Migrating to Google Analytics 4 (GA4) Should be a Priority
  • A Year in Review: The Digital Marketing Trends That Defined 2021
  • The Basics of Video Marketing
  • Just How Much Do Google Reviews Impact Your SEO Ranking?

Categories

  • Analytics & ROI Analysis
  • Company News
  • Content
  • Conversion Optimization
  • CRO
  • Display Advertising/RTB
  • Email Marketing
  • En Español
  • En Français
  • Inbound Marketing
  • Lead Nurture & Marketing Automation
  • Local Search
  • Marketing
  • Mobile
  • Partnership Marketing
  • PPC
  • PR
  • SEO
  • Social Media Marketing
  • Web Design

Additional Posts

google adwords sitelinks performance stats

How to Improve AdWords Performance with Sitelinks

June 12th, 2012 | by Louise McCartan

Why I think Link-based algorithm of Google is good and Social metrics should only be an additional help

June 11th, 2012 | by Manish Pandey

How To Find Your Voice Before You Start To Blog

June 8th, 2012 | by Ruud Hein

LET'S TALK

Need more information or want to get in touch?

Get in touch!
  • SEO
  • SEM
  • Display
  • Blog
  • Why Us
  • Join Our Team
  • Contact Us
  • Local SEO
  • Small Business SEO
  • Enterprise SEO
  • International SEO

LOCATION

1305 Pickering Parkway,
5th Floor Pickering, L1V 3P2

PHONE

Toll Free: 1-877-695-7388
Greater Toronto Area: (647) 699-2838

Social

© Search Engine People Inc. 2023 – Canada’s Top Digital Agency
© SEP 2023 – A Search Engine People Company | Privacy Policy

Search Engine People