Support » Fixing WordPress » How to eliminate Google Analytics .js

  • Resolved RobotFX


    Every time I run a website speed test, I get a message to optimize the analytics .js from Google.

    However, I am not using analytics. It does not appear anywhere within the page’s source code. So… where is it?

    Also (might be related) there are a bunch of scripts from WP that I didn’t put there in the footer, like mustache.js, notes-common-v2.js, admin-bar-v2.js. Is there a way to remove them? Maybe one of them loads the analytics .js.

    • This topic was modified 2 years, 6 months ago by RobotFX.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Somewhere in your theme you have google analytics code. It is usually in the header or footer. I am not familiar with your theme. Are you using a custom theme? if so look in the header.php and footer.php for google analytics scripts.

    Hope this helps.

    Moderator Steven Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    Your site is running GA. Look view-source on your page.

    <script type="text/javascript">||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
    				ga('create', 'UA-120902442-1', { 'cookieDomain': '' } );
    				// Plugins
    				ga('require', 'ec');
    				ga('send', 'pageview');</script> <script async src=""></script>;

    Disable all plugins and view the page source. If the GA code is gone, then turn them back on one at a time until it comes back.


    Actually, you do have a Google Analytics code in your page source –

    The code can usually be found in several places:

    • Theme option which lets you add code in the <head> section;
    • Header and footer script plugin, or any other plugin that might handle SEO or analytics;
    • header.php file;
    • functions.php file.

    @wattaman I reviewed the code again myself and I still believe that the code is saved somewhere in the header.php or footer.php. However, it is possible that it is also in a plugin as @sterndata has suggested. Another suggestion that might take less time than disabling all your plugins and reactivating them one by one would be that you check your plugin settings especially for any SEO plugins you may have configured such as Yoast and make sure that you or someone you have worked with has not entered data for a google analytics account.

    Thanks, guys.
    I believe it only appears for visitors, but not admin, because I still don’t have it 🙂 It’s the only thong I can think of.

    Anyway, I’m gonna check home because now I’m driving, and confirm after.

    If it is not showing up when you check the code in your browser as an admin then it is surely a plugin. Some plugins that add google analytics code will hide it when you are logged in as an admin.

    Davood, you were right. It was a plugin. I’ve removed it and it’s gone now.
    Thanks everyone for the help.

    PS funny thing, since I’ve done it, the PageSpeed Insights shows me a lower score 🙂 … but that’s another discussion.

    PageSpeed insights likes it when you have the analytics code in there… It’s kinda annoying actually. I have to explain this to clients all the time who are like I want my score to be as close to 100% as possible but I don’t want analytics code in there. Ah well. Glad you found the culprit. Out of curiosity what plugin was it?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘How to eliminate Google Analytics .js’ is closed to new replies.