Google Analytics for WordPress Cannot Handle .co.za Domains? (7 posts)

  1. onelargeprawn
    Posted 6 years ago #

    I am using Google Analytics 2.9.2 on my WordPress blog at http://www.onelargeprawn.co.za and I believe there is an issue with onclick tracking for Google Anaytics when it comes to domain with two dots, for example .co.za.

    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 .co.za the onclick parameter is not being added.

    If you view the page source for this post (http://www.onelargeprawn.co.za/2009/05/29/lookie-look-win-ufc-2009-with-the-ps3-blog/) you'll see that the link to Metacritic.com has the onclick parameter, but the link to ps3blog.co.za does not. I've checked other posts that contains links to co.za sites and none of them have the parameter as well.

    Is this a bug?

  2. onelargeprawn
    Posted 6 years ago #

    Bump. Any assistance here?

  3. Restless Web
    Posted 6 years ago #

    Hey man, I'm using Google Analyticator on my site at http://www.triharder.co.za and haven't had any problems. Try using that one instead?

  4. onelargeprawn
    Posted 6 years ago #

    Cheers triharder, I'll investigate Googly Analyticator.

  5. Lee Willis
    Posted 6 years ago #

    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);
  6. Joost de Valk
    Posted 6 years ago #

    Added in 3.2.1 :) Thanks for the patch!

  7. lukehardiman
    Posted 5 years ago #

    Hi, I'm on a .co.za 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.

Topic Closed

This topic has been closed to new replies.

About this Topic