Support » Plugins » Google Analytics for WordPress Cannot Handle Domains?

  • I am using Google Analytics 2.9.2 on my WordPress blog at and I believe there is an issue with onclick tracking for Google Anaytics when it comes to domain with two dots, for example

    I looked at the page source, and I noticed that all .com (or .net. or .org) links have the “onclick=”javascript:pageTracker._trackPageview()” parameter, BUT for any link that ends in the onclick parameter is not being added.

    If you view the page source for this post ( you’ll see that the link to has the onclick parameter, but the link to does not. I’ve checked other posts that contains links to sites and none of them have the parameter as well.

    Is this a bug?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Bump. Any assistance here?

    Hey man, I’m using Google Analyticator on my site at and haven’t had any problems. Try using that one instead?

    Cheers triharder, I’ll investigate Googly Analyticator.

    Lee Willis


    Try replacing the body of the ga_get_domain function with this one:

    $hostPattern = "/^(http:\/\/)?([^\/]+)/i";
                            $domainPatternUS = "/[^\.\/]+\.[^\.\/]+$/";
                            $domainPatternUK = "/[^\.\/]+\.[^\.\/]+\.[^\.\/]+$/";
                            preg_match($hostPattern, $uri, $matches);
                            $host = $matches[2];
                            if (preg_match("/.*\..*\..*\..*$/",$host)) {
                                    preg_match($domainPatternUK, $host, $matches);
                            } else {
                                    preg_match($domainPatternUS, $host, $matches);
                            return array("domain"=>$matches[0],"host"=>$host);
    Joost de Valk


    Added in 3.2.1 🙂 Thanks for the patch!

    Hi, I’m on a domain, PHP 5, latest version of the plugin and I am experiencing a strange bug:

    I first noticed that this site has no stats since late August. Then I went in to the settings, and noticed the site id was no longer there. So I put it back in, but the plugin refused to accept my input. All text input fields have a question mark character in them (I’m using Firefox 3.5.3) which I think indicate some kind of text-encoding corruption.

    Every time I try to update the settings for the plugin I get the message: “Google Analytics settings reset to default.”

    I have tried disabling the plugin, deleting all the plugin files from my server and reinstalling, but to no avail. Any assistance gratefully received.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Google Analytics for WordPress Cannot Handle Domains?’ is closed to new replies.