Title: Tracking doesn&#039;t work
Last modified: August 21, 2016

---

# Tracking doesn't work

 *  Resolved [druppel](https://wordpress.org/support/users/druppel/)
 * (@druppel)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/)
 * 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/](http://wordpress.org/plugins/wp-piwik/)

Viewing 15 replies - 16 through 30 (of 30 total)

[←](https://wordpress.org/support/topic/tracking-doesnt-work/?output_format=md) 
[1](https://wordpress.org/support/topic/tracking-doesnt-work/?output_format=md) 
2

 *  [maffi91](https://wordpress.org/support/users/maffi91/)
 * (@maffi91)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441533)
 * 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!
 *  Thread Starter [druppel](https://wordpress.org/support/users/druppel/)
 * (@druppel)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441536)
 * 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…
 *  Thread Starter [druppel](https://wordpress.org/support/users/druppel/)
 * (@druppel)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441537)
 * WP-Piwik adds a reference at the webpages to piwik.js at the root of the server,
   which is not found (404).
 *  [chrisbfotografie](https://wordpress.org/support/users/chrisbfotografie/)
 * (@chrisbfotografie)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441538)
 * 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.
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441540)
 * -> 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.
 *  Thread Starter [druppel](https://wordpress.org/support/users/druppel/)
 * (@druppel)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441542)
 * 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](http://codex.wordpress.org/Child_Themes)–
   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
 *  [mgc8](https://wordpress.org/support/users/mgc8/)
 * (@mgc8)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441544)
 * “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?
 *  [mgc8](https://wordpress.org/support/users/mgc8/)
 * (@mgc8)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441545)
 * 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
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441558)
 * 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 😉
 *  [dEM0nsTAr](https://wordpress.org/support/users/dem0nstar/)
 * (@dem0nstar)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441596)
 * 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!
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441598)
 * 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).
 *  [dEM0nsTAr](https://wordpress.org/support/users/dem0nstar/)
 * (@dem0nstar)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441599)
 * 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=](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&gt](http://www.domain.tld</main_url&gt);
   <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=](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
 *  [001101](https://wordpress.org/support/users/001101-1/)
 * (@001101-1)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441600)
 * Same Problem here, just don’t works, would be nice if a REAL FIX is possible…
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441601)
 * 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](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.
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441638)
 * The PHP API issue is fixed in 0.9.9.9.

Viewing 15 replies - 16 through 30 (of 30 total)

[←](https://wordpress.org/support/topic/tracking-doesnt-work/?output_format=md) 
[1](https://wordpress.org/support/topic/tracking-doesnt-work/?output_format=md) 
2

The topic ‘Tracking doesn't work’ is closed to new replies.

 * ![](https://ps.w.org/wp-piwik/assets/icon-256x256.png?rev=3529668)
 * [Connect Matomo - Analytics Dashboard for WordPress](https://wordpress.org/plugins/wp-piwik/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-piwik/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-piwik/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-piwik/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-piwik/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-piwik/reviews/)

 * 30 replies
 * 8 participants
 * Last reply from: [braekling](https://wordpress.org/support/users/braekling/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/tracking-doesnt-work/page/2/#post-4441638)
 * Status: resolved