WordPress.org

Support

Support » Plugins and Hacks » Solution for using Ultimate Google Analytics for WordPress 3.0

Solution for using Ultimate Google Analytics for WordPress 3.0

  • Bad_Egg
    Participant

    @bad_egg

    I installed the Ultimate Google Analytics in WordPress 3.0, and the plug-in failed, but with a little digging I found the solution:

    There are two lines of code missing and one slightly different line from the code now provided by Google. The code on my site now reads:

    <!– tracker added by Ultimate Google Analytics plugin v1.6.0: http://www.oratransplant.nl/uga –>
    <script type=”text/javascript”>
    var gaJsHost = ((“https:” == document.location.protocol) ? “https://ssl.” : “http://www.”);
    document.write(unescape(“%3Cscript src='” + gaJsHost + “google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E”));
    </script>
    <script type=”text/javascript”>
    try{
    var pageTracker = _gat._getTracker(“UA-16468802-3”);
    pageTracker._initData();
    pageTracker._trackPageview();
    } catch(err) {}
    </script>
    </body>
    </html>

    Note the additional lines:
    “try{“
    “} catch(err) {}”

    and check the line with your account number in it as there may be unnecessary info.

    I fixed these lines and now it works.

    NOTE: IF YOU ARE USING GOOGLE ANALYTICS FOR THE FIRST TIME, you must create the account BEFORE you install the plug-in or it won’t find your account number. To sign up for your account, go here:
    http://www.google.com/analytics/sign_up.html.

    NOTE: IF YOU ALREADY HAVE A GOOGLE ANALYTICS ACCOUNT for your website and are using WordPress for your blog but not the whole of your website, then your blog will lie in a separate folder on your server distinct from your website folder. You will thus need to create a secondary profile, using the address of your blog and treating it as a NEW domain, in your Google Analytics account BEFORE you install the plugin, otherwise it won’t find the right account number, or an account number at all; and Google will not find the code because it won’t be looking at your blog home page, only your website home page.

    To illustrate: my website is http://www.mademers.com, not created using WordPress; and I have Google Analytics installed in the code of my home page. My blog, built using WordPress via an option in my server account, lies in a separate folder and has the URL of http://www.mademers.com/bad_egg/. Thus I needed to create a profile in my Google Analytics account for the new domain of http://www.mademers.com/bad_egg/. The profile was given the account number UA-16468802-3, that is my main account number with an additional “-3” attached (it should have been -2 but I thought I screwed up the first time and deleted the profile, so I had to redo it, and thus I ended up with -3). It is THIS account number that needed to be in the code illustrated above.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • Bad_Egg
    Participant

    @bad_egg

    I should add that if you install the plug-in before setting up the profile, it’s not actually a problem: just edit the code for the plug-in, changing your account number from the default “XX-etc” to your profile account number. Then go into your Google account and test the page to see if it’s now collecting data.

Viewing 1 replies (of 1 total)
  • The topic ‘Solution for using Ultimate Google Analytics for WordPress 3.0’ is closed to new replies.