0

I'm running into an issues where Google is crawling invalid URLs. It is caused by inline javascript from an onclick within a href property. The onlcick is used for sitecatalyst clickmap tracking and looks like

<a href="http://www.commerce.com/cp/Value-of-the-Day/1058864" onclick="s_objectID="http://www.commerce.com/cp/Value-of-the-Day/1058864_1";return this.s_oc?this.s_oc(e):true">Specials</a>

How do I get Google to not crawl the clickmap tracking and/or implement the clickmap in a way that will not be crawlable by searchengines. Would this.s_oc(e):false work?

Jason Youk
  • 802
  • 2
  • 8
  • 20
  • 2
    move the code to a function and attach the function to the link's click event using [addEventListener](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener) – CrayonViolent Nov 11 '14 at 02:20
  • 1
    I would also point out that at face value, it *may* be crawling that on-click link because the code you posted is invalid syntax. You are using double-quotes within double quotes without escaping them, so this may be causing the browser to render the link wrong and google may be parsing it as the link's target. This is just a guess and may or may not be true, but weird things happen when you don't use proper syntax! – CrayonViolent Nov 11 '14 at 02:23
  • 1
    I would also point out that unless you do some kind of encrypt/decrypt system on the links, e.g. output the url as an encrypted value, then use js to decrypt it and make use of the url.. if it's visible in your source code, a crawler can scrape for it, regardless of where it is. – CrayonViolent Nov 11 '14 at 02:25
  • 1
    I've seen this issue arise from the use of the dynamicobjectid plug-in. It seems to generate invalid JS which it attaches to the onClick handler. Firefox seems to parse this as the code is intended to function but Google Chrome doesn't handle the malformed code gracefully. – krex Nov 15 '14 at 15:05
  • DynamicObjectIDs plugin is not supported and no longer function due to their use of functionality that no longer exists in the new AppMeasurement for JavaScript library. – shamshul2007 Aug 26 '15 at 20:49

0 Answers0