Google Analytics for WordPress plugin is incompatible with AddThis plugin

Google Analytics for WordPress plugin adds an onclick attribute to links when “Track outbound clicks & downloads” is enabled irrespective of whether there is already an onclick attribute. AddThis plugin adds a link with onclick attribute to the post when enabled. This combination causes WordPress to generate invalid mark up. Same would happen if the post contains any links with onclick attribute (very unlikely scenario).

I have created a patch (with Git) that adds the content of $coolBit to the existing onclick attribute (without onclick=””) else a new onclick attribute is added with the $coolBit. You can download the patch. I have also reported the issue to Joost (plugin developer).

Hope this will be useful for someone in a similar situation until the fix makes it into the plugin.

If you enjoyed this post, make sure you subscribe to my RSS feed!

2 thoughts on “Google Analytics for WordPress plugin is incompatible with AddThis plugin”

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.