• Hello, since I’ve declared my site as XHTML 1.0 Strict, when the Google Analytics plugin adds the tracking code to the blogroll links, it breaks the validation by inserting the target property in the anchor link along with the onclick javascript code.

    It was easy to solve it, by simply replacing the hook:
    $bookmarks[$i]->link_target .= $trackBit;
    with
    $bookmarks[$i]->link_rel .= $trackBit;

    so the JS tracking code could be appended without hassle

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter 3dolab

    (@3dolab)

    UPDATE:
    I believe the fix won’t work

    The output looks like:
    <a href="https://mysite.com" rel="friend, external, nofollow&quot; onclick=&quot;javascript:_gaq.push([...]);">

    So I reverted back to the official code, the tracking now runs again but the page still fails the XHTML validation:
    <a href="https://mysite.com" rel="friend, external, nofollow" target="" onclick="javascript:_gaq.push([...]);">

    How could the JS code be injected into the rel attribute and preserve formatting of double quotes as it does with target??

    Thread Starter 3dolab

    (@3dolab)

    the only way to do that requires to edit wp-includes/bookmark-template.php and replace
    $rel = ' rel="' . esc_attr($rel) . '"';
    with
    $rel = ' rel="' . $rel . '"';

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Google Analytics for WordPress] Failed XHTML Strict validation’ is closed to new replies.