WordPress.org

Ready to get started?Download WordPress

Forums

WP-Piwik
Tracking doesn't work (30 posts)

  1. druppel
    Member
    Posted 3 months ago #

    Both on my piwik installation (I maintain two sites) and at the local Piwik data within WP there is no data recorded for my WP site after upgrading to WP 3.8, while the JetPack shows at least more visitors, I will try to manually appending the javascript instead of using WP-Piwik.

    http://wordpress.org/plugins/wp-piwik/

  2. braekling
    Member
    Plugin Author

    Posted 3 months ago #

    Can you give a more detailed description? The WP-Piwik settings are still fine? The tracking code is added to WordPress as expected?

  3. druppel
    Member
    Posted 3 months ago #

    I have reinstalled the plugin yesterday, I used the same sited and Api key as is stated on my main piwik install for my wordpress site. Did that yesterday and this morning the counter was still stuck at 0...

    I take it the tracking code is not added to WP.

  4. braekling
    Member
    Plugin Author

    Posted 3 months ago #

    Adding the tracking code is enabled? And is the tracking code fetched as expected?

    Maybe you are using this "audio bar" plugin?
    http://wordpress.org/support/topic/wp-piwik-in-conflict-with-audiobar-plugin?replies=2

  5. petervnv
    Member
    Posted 3 months ago #

    I have the same problem. Using WP 3.8

    When I add the API key and click save, I get the message:
    An error occured: Please check URL and auth token. You need at least view access to one site.

    Now I'm pretty sure my url and api key are correct. I enabled auto-config and I see there are two blogs (I only have one) with the exact same name in my Piwik dashboard, but both show 0 traffic.

  6. petervnv
    Member
    Posted 3 months ago #

    I see the following error message when I run system check:

    Error:
    Try #1: LOAD DATA INFILE : SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user 'piwik'@'localhost' (using password: YES)[28000],
    Try #2: LOAD DATA LOCAL INFILE : SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version[42000]

    I'm using MySQL version 5.5.33 and PHP 5.5.7 on Debian Wheezy. Pretty sure the password is OK but I will recheck

  7. braekling
    Member
    Plugin Author

    Posted 3 months ago #

    WP-Piwik does not access your Piwik database. So the SQL errors should be caused by Piwik itself.

    Did you try to disable WP-Piwik's caching as mentioned in different support threads? (Settings -> Tracking)

  8. petervnv
    Member
    Posted 3 months ago #

    Hi,

    Disabling caching indeed fixed the wp error message on the plugin.

    Now I still have the remaining problem that piwik appears to not work for me at all. I think it's a compatibility issue between my (super) recent version of MySQL and what piwik expects.

  9. braekling
    Member
    Plugin Author

    Posted 3 months ago #

    Sorry, but I can't help you with Piwik issues. Have a look at the Piwik community instead: http://piwik.org

  10. petervnv
    Member
    Posted 3 months ago #

    Yeah, I know. Separate things.

    Thanks for your help with the plugin.

    Cheers

  11. mgc8
    Member
    Posted 3 months ago #

    Hello,

    I am also seeing the same problem on three of my blogs, and nothing I tried so far seems to have helped:

    1. Updated Piwik -- it's now on 2.0.2
    2. Updated WP -- 3.8
    3. Updated WP-Piwik -- 0.9.9.7
    4. Configuration -- reset, no difference
    5. Auth token -- reset password, copied new token, no difference

    I also unticked "Enable cache" under WP-Piwik -> Piwik Settings -- no difference.

    I get two different errors:
    - under "Home":
    An error occured: Piwik did not answer. Please check your entered Piwik URL.
    - under "Piwik Settings":
    An error occured: Please check URL and auth token. You need at least view access to one site.

    Of course, both the URL and auth token are correct (please note, this happens on three different blogs).

    Piwik itself works perfectly fine, which is evident when I add the tracking code manually; however WP-Piwik itself does not add any code.

    Running the tests under "Support" however gives correct results:
    *** Test 1/2: SitesManager.getSitesWithAtLeastViewAccess ***
    HTTP/1.1 200 OK, expected XML
    *** Test 2/2: SitesManager.getSitesIdFromSiteUrl ***
    HTTP/1.1 200 OK, expected XML

    Maybe a useful hint is that the "Get site configuration details" link does not seem to get the right Piwik ID for the site, even though it does get the title and URL.

    If I can venture a guess, are we facing a problem parsing the XML maybe?

    Thanks for any help and please let me know if I can provide more information.

    Regards,
    Mihnea

  12. chrisbfotografie
    Member
    Posted 3 months ago #

    I have exactly the same problem like Mihnea described above on my blog.
    best regards
    Chris

  13. maffi91
    Member
    Posted 3 months ago #

    Yep, here the same problem :(

  14. druppel
    Member
    Posted 3 months ago #

    The tracking link seems to be added ok though, so this must be a Piwik problem, not a WP-Piwik problem.

  15. maffi91
    Member
    Posted 3 months ago #

    Hm but before the wp-piwik update, piwik works fine ...

  16. druppel
    Member
    Posted 3 months ago #

    Dit anyone contact Piwik already? The've made the upgrade, WP-Piwik did as did WordPress. Three points of possible failure.

  17. maffi91
    Member
    Posted 3 months ago #

    Why Piwik?

    Before i install the wp-piwik update, the tracking works fine. After that the tracking is stopped. I'am sure this is a wp-piwik bug!

    On my other sites (typo3) piwik (is the same one) works fine!

  18. druppel
    Member
    Posted 3 months ago #

    OK, I just checked and it's working now, here's my config:
    Piwik is fine.

    I've added the tracking code from my main Piwik install for my WordPress site to my child theme's footer.php, just above </body>.

    WP-Piwik shows a wrong SiteId and it doesn't update itself.

    Time to uninstall and do as I did...

  19. druppel
    Member
    Posted 3 months ago #

    WP-Piwik adds a reference at the webpages to piwik.js at the root of the server, which is not found (404).

  20. chrisbfotografie
    Member
    Posted 3 months ago #

    Thx druppel!

    Did the same for now. Deactivated WP-Piwik and added the tracking code manually to my Child-Theme's footer.php, because the timeout of the script also made my blog load really slow.

    Hope the problem gets solved soon.

  21. braekling
    Member
    Plugin Author

    Posted 3 months ago #

    -> If the site id is wrong, you should try to reset WP-Piwik. Go to "settings -> support" to check the estimated site IDs (site configuration details) and to reset WP-Piwik's settings.

    -> If you are using Piwik's standard tracking code, WP-Piwik will fetch the tracking code from Piwik itself. This tracking code also should load Piwik's piwik.js (see the Piwik root directory to find piwik.js).

    mgc8's problem sounds really strange (the debug script uses the same functions as WP-Piwik itself... so a working debug script should be equal to a working WP-Piwik setup) and I'm really sorry I don't have an idea how to solve it.

    But this differs from the other problem which is caused by the "not found" piwik.js - to get behind this I need some more information, e.g. what is your (WP-Piwik!) tracking code looking like? Does WP-Piwik work if you just disabled tracking and add the tracking code manually? Did you try to use the "js/index.php" tracking?

    By the way: If you don't change WP-Piwik's settings, the tracking code will not change if you update Piwik itself. In that case an issue caused by the tracking code delivered by Piwik won't occur until WP-Piwik is updated (and the tracking code is updated automatically). So without detailed information I can't tell you if the issue is caused by WP-Piwik or Piwik.

  22. druppel
    Member
    Posted 3 months ago #

    Thank you very much for building the plug-in, I've used it a lot, but when things start to malfunction, regardless of who could be blamed, it gives me peace of mind to know everything is now built into my child theme. :)

    Only when one has a Piwik-installation separate from a WordPress-installation one could follow the next steps:

    On ones main installation:
    - log in to Piwik.
    - make a new website inside Piwik.
    - copy the tracking code of the new website.

    On ones WordPress-site:
    - make a Child Theme
    - copy footer.php from the template theme folder to the child theme folder
    - paste the tracking code from the main Piwik-installation just above </body> in the child theme's footer.php

  23. mgc8
    Member
    Posted 3 months ago #

    "mgc8's problem sounds really strange (the debug script uses the same functions as WP-Piwik itself... so a working debug script should be equal to a working WP-Piwik setup) and I'm really sorry I don't have an idea how to solve it."

    Well, that's quite unfortunate... Maybe we can help debug this so you can get a better idea? For the record, I just updated to the latest version of WP-Piwik (0.9.9.8) and the behaviour is the same.

    Here is what the second test reports, I would guess the format is somehow incompatible with what WP-Piwik expects?

    "*** Test 2/2: SitesManager.getSitesIdFromSiteUrl ***
    (...)
    <?xml version="1.0" encoding="utf-8" ?>
    <result>
    <row>
    <idsite>4</idsite>
    </row>
    </result>
    Time: 0.05s

    The reason I'm saying that is because on the "Get site configuration details" page there is no proper ID detected. So it seems WP-Piwik can't get the ID correctly, therefore it doesn't get the tracking code either... does that make any sense?

  24. mgc8
    Member
    Posted 3 months ago #

    Ok, so I tracked this down to the considerable API changes in Piwik 2.0. Frankly I believe this works only for people who use the "REST" API, it should break for everyone using the "PHP" one, given that on my system the "callPHP" function returned NULL constantly before I patched it.

    Anyway, the problem is basically that Piwik switched to using namespaces extensively and all code has been re-factored to take this into account. Given that WP-Piwik includes Piwik source code directly and instantiates the "Piwik_API_Request" class, it fails silently due to the class being renamed to "Piwik\API\Request".

    So here it goes... In "wp-piwik.php", replace the "function callPHP()" with the follwing:

    function callPHP($strParams) {
                    if (PIWIK_INCLUDE_PATH === FALSE)
                            return serialize(array('result' => 'error', 'message' => __('Could not resolve','wp-piwik').' "'.htmlentities(self::$settings->getGlobalOption('piwik_path')).'": '.__('realpath() returns false','wp-piwik').'.'));
                    if (file_exists(PIWIK_INCLUDE_PATH . "/index.php"))
                            require_once PIWIK_INCLUDE_PATH . "/index.php";
                    if (file_exists(PIWIK_INCLUDE_PATH . "/core/API/Request.php"))
                            require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
                    if (class_exists('Piwik_FrontController'))
                            Piwik_FrontController::getInstance()->init();
                    else if (class_exists('Piwik\FrontController'))
                            Piwik\FrontController::getInstance()->init();
                    // Add Piwik URL to params
                    $strParams .= '&piwikUrl='.urlencode(self::$settings->getGlobalOption('piwik_url'));
                    // This inits the API Request with the specified parameters
                    if (class_exists('Piwik_API_Request'))
                            $objRequest = new Piwik_API_Request($strParams);
                    else if (class_exists('Piwik\API\Request'))
                            $objRequest = new Piwik\API\Request($strParams);
                    else return NULL;
                    // Calls the API and fetch XML data back
                    return $objRequest->process();
            }

    ... this should make Piwik detect the site correctly. The tracking code is still not picked up right, but I guess similar changes have to be made to the code there.

    Hope this helps in tracking it down.

    Regards,
    Mihnea

  25. braekling
    Member
    Plugin Author

    Posted 3 months ago #

    Thank you very much!

    I didn't know you are using the PHP API. Now I have a hint to figure this out... and of course I'll do so ;-)

  26. dEM0nsTAr
    Member
    Posted 2 months ago #

    Could you please fix this officially?
    Since I updated Piwik from v1 to v2 WP-Piwik doesn't track my visitors anymore...
    Thanks in advance!

  27. braekling
    Member
    Plugin Author

    Posted 2 months ago #

    This will be fixed officially by and by - as I wrote above.

    Meanwhile please switch to the REST API, which is not in beta status (compared to the PHP API).

  28. dEM0nsTAr
    Member
    Posted 2 months ago #

    I always use and used the REST API but it doesn't work anymore since I updated Piwik to v2:

    *** Test 1/2: SitesManager.getSitesWithAtLeastViewAccess ***
    Using: cURL
    SSL peer verification: enabled
    User Agent:
    Call: http://www.domain.tld/piwik/?module=API&method=SitesManager.getSitesWithAtLeastViewAccess&format=XML&token_auth= + TOKEN
    Result:
    HTTP/1.1 200 OK
    Server: nginx
    Date: Sun, 02 Feb 2014 18:49:46 GMT
    Content-Type: text/xml; charset=utf-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Vary: Accept-Encoding
    X-Powered-By: PHP/5.5.8-1~dotdeb.1
    Set-Cookie: PIWIK_SESSID=ogq3fu7lrsi1f4fub9qmh8ra50; path=/; HttpOnly
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache

    <?xml version="1.0" encoding="utf-8" ?>
    <result>
    <row>
    <idsite>1</idsite>
    <name>Blog</name>
    <main_url>http://www.domain.tld</main_url>
    <ts_created>2009-12-31 00:00:00</ts_created>
    <timezone>Europe/Berlin</timezone>
    <currency>EUR</currency>
    <excluded_ips />
    <excluded_parameters />
    <excluded_user_agents />
    <sitesearch>1</sitesearch>
    <sitesearch_keyword_parameters />
    <sitesearch_category_parameters />
    <group />
    <type>website</type>
    <keep_url_fragment>0</keep_url_fragment>
    <ecommerce>0</ecommerce>
    </row>
    </result>
    Time: 0.12s

    *** Test 2/2: SitesManager.getSitesIdFromSiteUrl ***
    Using: cURL
    SSL peer verification: enabled
    User Agent:
    Call: http://www.domain.tld/piwik/?module=API&method=SitesManager.getSitesIdFromSiteUrl&url=http%3A%2F%2Fwww.domain.tld&format=XML&token_auth= + TOKEN
    Result:
    HTTP/1.1 200 OK
    Server: nginx
    Date: Sun, 02 Feb 2014 18:49:46 GMT
    Content-Type: text/xml; charset=utf-8
    Transfer-Encoding: chunked
    Connection: keep-alive
    Vary: Accept-Encoding
    X-Powered-By: PHP/5.5.8-1~dotdeb.1
    Set-Cookie: PIWIK_SESSID=6lt56dhbap3scfrnjjs79pvgi6; path=/; HttpOnly
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache

    <?xml version="1.0" encoding="utf-8" ?>
    <result>
    <row>
    <idsite>1</idsite>
    </row>
    </result>
    Time: 0.11s

  29. 001101
    Member
    Posted 2 months ago #

    Same Problem here, just don't works, would be nice if a REAL FIX is possible...

  30. braekling
    Member
    Plugin Author

    Posted 2 months ago #

    deM0Nstar:

    Please don't mix different topics. The problem describe by mgc8 is only regarding the PHP API. So also the fix will only work for this issue.

    Which tracking mode are you using? If it is proxy mode, please try another one. In this case I may have an idea about a solution, see http://wordpress.org/support/topic/doesnt-work-when-proxy-script-is-configured

    001101: Please switch to the REST API until the fix is not available.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.