Support » Plugin: All in One SEO Pack » Universal Analytics Not Working

  • Resolved thefitrv


    Uh… I read through the other thread.
    Apparently, this was supposed to have been fixed with version 2.1.5.
    I have installed that version. Nothing happening.

    I have added my UA-6666whatever code in the plugin’s configuration page.

    If I DO NOT SELECT Universal Analytics option, I get the old code to appear on my site. This is fine, and this is how I’m running now since it’s broken.

    However, if I select the checkbox for Universal Analytics – I get no code at all appearing on the site. Nothing. Nada.

    I have NOT selected or entered anything for domain tracking, outbound links, advertising whatever, or any of the other options related to GA.

    Strangely, if I click the button “Connect with Google Analytics”, I am presented with a login page, and it appears to connect WITH THE WRONG PROPERTY in Google Analytics. No option to select a property or fix it. So I’ve backed out of that option as well.

    Any clue why none of this is working (except the old code, thank goodness!)?

Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Contributor Peter Baylies


    Hi thefitrv,

    If you click the button, after you connect, you should get a drop-down with the associated properties, if any. If you have your code entered and you check Universal Analytics, obviously you should end up with that tracking code appearing in your source code. If you’d like to troubleshoot this further, set it up and give me the url for your website, and I can take a look at what’s being output.

    Hi. Sorry, I’ve been out on vacation.
    I tried again. Didn’t work.

    Here is what the setup screen looks like before I click the button. The old-style analytics work fine and put this tracking code on my pages properly. Notice that the property id ends in “-2”, which is correct:

    Before UA

    Now here’s what it looks like after clicking the connect button, and enabling universal analytics. Notice that the property with “-2” is not even available to select, though it it very much in my analytics account:

    After UA

    I decided I can’t leave it set this way because the two sites aren’t related at all, and I don’t want to misreport, well, everything. For now, I’m just leaving the old tracking code there.

    I will see if I have a site that I don’t care about, using the same host, where I can enable the bad tracking code and we’ll see what happens there.

    Any other ideas?

    Plugin Contributor Peter Baylies


    Hi thefitrv,

    I see the other property is the same except that it ends in -3 — do you have both of those properties associated with the same Google account? I’d be interested to know why one of them is showing up and the other isn’t. However, note that you can check Universal Analytics and you don’t have to click the connect button at all, you can just keep your property id filled in manually. Just make sure in your Google account that the property id in question is indeed set up to use Universal Analytics.

    I tried that initially. Just tried it again with the same result.

    Right now, I have Universal Analytics checked, and my correct UA property ID filled in.

    But there is no Google Analytics tracking code (old or UA version) on the site at all. I can leave this up for a couple hours. It won’t count traffic, but at least it won’t credit it to the wrong property.

    Site is

    Let me know if you see anything. (and yes, I just cleared the cache)


    Plugin Contributor Peter Baylies


    Hi thefitrv,

    That page is not only cached by WP Super Cache, but it’s also minified, with comments stripped, and it looks like probably run through CloudFlare as well. It looks like “autoptimize” is pulling your inline Javascript out of the page and into another Javascript file (at the bottom of the page), and that is where your Google Analytics ID is showing up. In the future I’d suggest doing your testing on a development server if possible, with all cache-related plugins and services and minification disabled.

    Peter –

    Thank you. I’m appropriately embarrassed now. I should have checked *all* the linked .js on the page. My bad.

    As an FYI though – in case anyone else sees this – with the previous, Non-UA tracking code, autoptimize left it alone, and the Google Analytics code was plainly visible on the page itself – not linked.

    When switched to UA, autoptimize now catches the new Google Analytics tracking code, and moves it to the autoptimized and linked js file. Some strange interaction between the plugins I suppose.

    Thanks again, and I owe you a donation.

    Plugin Contributor Peter Baylies



    Cheers, I’m glad that helped you out. Strange that the code gets moved in one case and not in the other, though – it should be basically identical if you’re using Universal Analytics for both.

    Hi guys;
    I’m AO’s developer. AO automatically excludes GA old-style tracking from aggregation. I’ll exclude UA-tracking code by default in the next minor release, you can now just add it to the JS optimization exclusion-list yourself. Any unique string in the UA-JS that would be a good candidate to base exclusion on?

    kind regards,

    Plugin Contributor Peter Baylies


    Hi Frank,

    Thanks for the heads up; the start of the tracking code JS should be pretty unique – “(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]”


    thefitrv; can you try excluding “GoogleAnalyticsObject” in that case?


    OK. Added “GoogleAnalyticsObject” to the exclude list. The list now looks like this:


    Google Analytics tracking code – Universal Analytics version – is now appearing on the pages themselves, and is no longer in the Autoptimized and linked .js file.

    So basically, now all is working as it used to – but with the new UA code.

    Two questions – and I don’t mean to hijack my own thread to a different topic, but here goes:

    1: I assume from this that it’s better to NOT autoptimize/minify the Google Analytics code. But why?

    2: Will I need to remove this exclusion when the next version of AO is released?

    Thanks both of you for the help.

    1. GA needs to be inline in order to work
    2. no, it could stay there.

    glad it works!

    The test-version of 1.8.5, which I committed to the trunk-build yesterday, now excludes Universal Analytics from being aggregated. It would be great if you could download & test to confirm this does work (do remove the “GoogleAnalyticsObject” from your custom exclude list, otherwise this would not be a good test)?


    Removed GoogleAnalyticsObject from the exclude list and added your new version. Everything seems to work as it should.

    Should I just leave this version live until 1.8.5 is released? Or take it out and go back to 1.8.4 and wait for the official release? It would be easier to just leave this version live, as long as there are no other risks.


    You can leave this one, once the new version is pushed out (probably early next week) you’ll receive the update to the final 1.8.5 (which will probably be limited to changes in the readme.txt anyway).


Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Universal Analytics Not Working’ is closed to new replies.