Support » Plugin: Google Analytics Dashboard Plugin for WordPress by MonsterInsights » Anchor Link Changed – Includes Full URL

  • Hey Joost, I found a small issue in the plugin that others might experience too regarding Anchor Links and the pound # sign.

    While checking my site recently I discovered that my site was hammered to death by 404 errors all of which were ANCHOR Link related. After viewing source view of the HTML I discovered that literally every single anchor link in my site had full URL’s added in front of the anchor making all of them broke.

    For instance;
    <a href="#testing">testing</a> would become
    <a href="">testing</a>

    I think the fix for this is relatively easy and wanted to give you a heads up.

    GREAT Plugin none the less!
    Nice work…. 🙂


Viewing 6 replies - 1 through 6 (of 6 total)
  • I’ve experienced the same issue. I would love to see this resolved. It breaks JQuery scripts that rely on the #id for targeting. Meanwhile I’m using a different GA plugin.

    I ran into the same issue and solved it this morning. Try adding single quotes around the href content inside the double quotes like this:

    <a href="'#testing'">testing</a>

    That’s a decent interim fix, Michael. However, most of the time I run into this issue the hashed link is being generated by some JQuery or WordPress plugin and isn’t easily manipulated like that. For example, I’m trying to use Easy FancyBox.

    The ” trick didn’t work for me, however the following trick did it:
    1.) I padded the links with a space:
    <a class="fancybox" href=" #testing ">testing</a>
    This prevents the GA plugin to recognize and change it

    2.) I added a piece of javascript after all the elements

    <script type="text/javascript">
       jQuery('a.fancybox').each(function() {
          jQuery(this).attr('href', jQuery.trim(jQuery(this).attr('href')));

    This removes the space and now the links work as expected.

    Please note that it only works until GA plugin developers will trim the links (that’d make sense).



    Thanks for posting the bug and fixes

    I found the same problem today. I’m using a plugin that dynamically creats links and those links don’t work when using the Google analytics for WordPress plugin.
    Deactivating the Google analytics for WordPress plugin solves the problem.

    Unfortunately I cannot use the workarounds given in this thread as I don’t want to alter the code from the plugins (in case of future updates etc.)

    I’m using the latest version from the Google analytics for WordPress plugin.

    Is this going to be resolved in the near future?

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Anchor Link Changed – Includes Full URL’ is closed to new replies.