• Resolved codifex

    (@codifex)


    I updated WP-Piwik to 0.10.1.0 some days ago. Since the update existing websites of the multisite networks I am maintaining are added as new sites to Piwik automatically. This means that Piwik shows two separate statistics for the exact same site example.org. However, visits to the site are correctly assigned to the existing site containing the old statistics data. Statistics for the duplicate site entry are empty (no visits).

    I updated to WP-Piwik 1.0 and the problem still exists. It even occurs after uninstalling/reinstalling+reconfiguring WP-Piwik. I did not update Piwik in the meantime and the problem never occurred before.

    I am interested in any idea on how to fix it. In the meantime I deleted the duplicate sites in Piwik, but it seems that existing sites are added as duplicate from time to time (not all at once, but one after the other).

    https://www.ads-software.com/plugins/wp-piwik/

Viewing 15 replies - 1 through 15 (of 30 total)
  • Plugin Author braekling

    (@braekling)

    Just to be sure I understand your issue:

    WP-Piwik generates duplicates of your sites, but continues woking as expected (tracking code with correct site ID, stats are shown within WordPress)?

    Can you check, if the duplicates are configured with exactly the same URL as the original one? Or are there differences (protocoll, slashes, …)?

    Can you run the test script and check if the correct site ID (= Piwik site ID, not log ID) is estimated for your current site? (SitesManager.getSitesIdFromSiteUrl)

    Thread Starter codifex

    (@codifex)

    I will provide the information if the problem occurs again. Thank you for your quick reply.

    Thread Starter codifex

    (@codifex)

    I updated from 1.0 to 1.0.1. In the meantime a duplicate has been added again.

    Interestingly the duplicate with the new ID does NOT show up in WP-Piwik’s site browser.

    Here is an excerpt from the test script result:

    [12]=>
    array(16) {
    ["idsite"]=>
    string(2) "13"
    ["name"]=>
    string(30) "Example Site"
    ["main_url"]=>
    string(20) "https://example.org"
    ["ts_created"]=>
    string(19) "2014-10-07 21:34:43"
    ["ecommerce"]=>
    string(1) "0"
    ["sitesearch"]=>
    string(1) "1"
    ["sitesearch_keyword_parameters"]=>
    string(0) ""
    ["sitesearch_category_parameters"]=>
    string(0) ""
    ["timezone"]=>
    string(13) "Europe/Vienna"
    ["currency"]=>
    string(3) "EUR"
    ["excluded_ips"]=>
    string(0) ""
    ["excluded_parameters"]=>
    string(0) ""
    ["excluded_user_agents"]=>
    string(0) ""
    ["group"]=>
    string(0) ""
    ["type"]=>
    string(7) "website"
    ["keep_url_fragment"]=>
    string(1) "0"
    }
    ...
    [22]=>
    array(16) {
    ["idsite"]=>
    string(2) "30"
    ["name"]=>
    string(30) "Example Site"
    ["main_url"]=>
    string(20) "https://example.org"
    ["ts_created"]=>
    string(19) "2015-05-31 20:03:01"
    ["ecommerce"]=>
    string(1) "0"
    ["sitesearch"]=>
    string(1) "1"
    ["sitesearch_keyword_parameters"]=>
    string(0) ""
    ["sitesearch_category_parameters"]=>
    string(0) ""
    ["timezone"]=>
    string(13) "Europe/Vienna"
    ["currency"]=>
    string(3) "EUR"
    ["excluded_ips"]=>
    string(0) ""
    ["excluded_parameters"]=>
    string(0) ""
    ["excluded_user_agents"]=>
    string(0) ""
    ["group"]=>
    string(0) ""
    ["type"]=>
    string(7) "website"
    ["keep_url_fragment"]=>
    string(1) "0"
    }

    In Piwik, both sites have the same config (exactly the same URL, protocol, slashes, etc.).

    Plugin Author braekling

    (@braekling)

    A really strange behaviour. Do you observe any connection problems with WP-Piwik? E.g., you need to reload the settings or statistics page sometimes to get values?

    Are you using a HTTP or a PHP connection?

    Thread Starter codifex

    (@codifex)

    Today just one of about 22 sites has been added automatically about 10 times… really weird.

    The WP-Piwik backend works as expected, no connection problems.

    Are you using a HTTP or a PHP connection?

    How to determine that?

    Thread Starter codifex

    (@codifex)

    It seems that Piwik’s SitesManager.addSite can be called multiple times with the same address and Piwik creates entries in its sites table without an error. AFAIS the function addPiwikSite in WP-Piwik calls SitesManager.addSite. I am not familiar with the WP-Piwik source code, but maybe this function is invoked for some reason for sites that already exist in Piwik. Any input is appreciated.

    Plugin Author braekling

    (@braekling)

    Connection setting: HTTP API = HTTP connection, PHP API = PHP connection, cloud hosted = HTTP.

    Yes, the addSite request seems to be performed multiple times, obviously. But: It should only be called if no site ID is defined. But as you explained the site ID is available, the tracking code and the stats page work as expected.

    I have to go to the code line by line and to check how the request can be done anyway. As soon as I have an idea what happens I’ll tell you.

    Thread Starter codifex

    (@codifex)

    It’s a HTTP API connection.

    PHP API does not work because of basedir restrictions on the server.

    Thread Starter codifex

    (@codifex)

    BTW, I switched to the PHP API and then back to HTTP API because the PHP did not work because of basedir restriction errors. After doing that the site ID emitted by WP-Piwik in both the backend and on the site was “n/a”. I fixed this by resetting the WP-Piwik settings.

    Plugin Author braekling

    (@braekling)

    I checked the code, but I still didn’t get an idea how this could happen with a working WP-Piwik connection. Just if there were general problems with the connection (cached wrong site ID or similar stuff) WP-Piwik continues creating the site… but this also means the stats don’t work.

    (But if I understand your description, everything works fine – just the sites get duplicated by and by.)

    I added a little feature to WP-Piwik 1.0.2, maybe this will help:

    1. Go to the site browser (Settings -> WP-Piwik -> Support)
    2. Get the blog ID of the again and again duplicated site (the blog ID is the ID shown in the first row)
    3. Run the test script (Settings -> WP-Piwik -> Support)
    4. Add this parameter to the URL: &testscript_id= + the blog ID
    5. If you open this URL, the test script will run for this specific site. So if you check the result of Test 3/3: SitesManager.getSitesIdFromSiteUrl, you should see the URL WP-Piwik uses to estimate the Piwik site ID and what Piwik responses here.

    If you like to test WP-Piwik 1.0.2, feel free to download it now:
    https://downloads.www.ads-software.com/plugin/wp-piwik.1.0.2.zip

    The official release will be this evening and may contain some updated language files.

    Thread Starter codifex

    (@codifex)

    I am now using 1.0.2 and the problem occured again.

    https://example.org/ru has been added twice in Piwik, but shows only once (correclty) in WP-Piwik.

    I followed the procedure described above and ran the test script for the specific blog. Here is what it returned for the affected site:

    Test 3/3: SitesManager.getSitesIdFromSiteUrl
    
    array(2) {
      [0]=>
      array(1) {
        ["idsite"]=>
        string(1) "2"
      }
      [1]=>
      array(1) {
        ["idsite"]=>
        string(1) "7"
      }
    }

    Site ID 2 is the correct site ID whereas site ID 7 is the erroneously duplicated version.

    Any ideas are welcome!

    Thread Starter codifex

    (@codifex)

    I now even got multiple duplicates for a certain site.

    I am wondering if Piwik creates the duplicates on its own or if they are created by WP-Piwik.

    Plugin Author braekling

    (@braekling)

    I’m quite sure it’s caused by WP-Piwik. Piwik does not create sites on its own.

    My guess: In some cases the connection of your configuration may not work (just rare connections errors, nothing bad; maybe a timeout?) => WP-Piwik does not get an site ID and assumes, the site isn’t created yet => WP-Piwik asks Piwik to create a new site.

    I’m working on a new error handling which allows WP-Piwik to differ if it gets an empty answer by Piwik (= site does not exists, create a new one) or if it gets an erroneous answer (= don’t know if a site exists, don’t create a new one). Maybe this will fix the issue durably.

    If you want to test if the site is duplicated by Piwik or by WP-Piwik: Just give WP-Piwik an auth token which grants view access only. So WP-Piwik won’t be able to create new sites anymore.

    I can second that problem.

    After detecting some irregularities with the tracking, I found that we suddenly have 357 sites registered within Piwik (instead of 15 before). I can not say when this behaviour started, but it certainly points in the above direction. We do have a “weak” server (which runs both Piwik and WordPress).

    I’ve had problems since an automatic upgrade in mid-May. I’m no on 1.0.2.

    I have a WP with sites with WP site-ids 1,2,3,6,7 The main site is site 2 which for many years has logged tracking with an id of 4 on piwik. (Not sure of why there is that discrepancy, it was wp-piwik’s automatic site creation at the time).

    The mapping from WP site-id to piwik site=id has been for many years (successfully):
    WP 1 = Piwik 1
    WP 2 = Piwik 4
    WP 3 = Piwik 3
    WP 6 = Piwik 8
    WP 7 = Piwik 9

    Two symptoms since the update

    1) A number of new sites were created on piwik, these were multiples of the root domain, and a few duplicates. These ranged from piwik site id 10 through to 21. I have deleted these and they do not seem to have returned.

    2) All traffic for WP site 2 (my main active blog) is now logged on Piwik site 9 for some reason. The only thing that is interesting about Piwik Site 9 is that it is the last numerically, and the first in alphabetical order of site title. Is that significant?

    Happy to play with anything to help fix this. It is quite annoying. Is there anywhere in the settings to force the site id mapping for a particular WP site?

Viewing 15 replies - 1 through 15 (of 30 total)
  • The topic ‘Sites added to Piwik multiple times in WP multisite network since 0.10.1.0’ is closed to new replies.