WordPress.org

Ready to get started?Download WordPress

Forums

WP-Piwik
WP-Piwik generated Tracking Script no longer works (10 posts)

  1. PBoone
    Member
    Posted 7 months ago #

    Hello WordPress Support Team!

    Recently I updated Piwik to 2.0.3 (It was a jump from 1.X I think).
    Since then the Tracking Code JavaScript that the WP-Piwik Plug-In genereates is no longer identical to the Tracking Code JavaScript that PIWIK generates. What's worse is, that the Tracking Code JavaScript that WP-Piwik Plug-In generates no longe works! Meaning nothing gets counted in Piwik. So I had to disable the "Insert Trackingcode" Option in the WP-Piwik Plug-In, then manually insert the code generated from piwik into the footer of all my sites.

    We are using WP-Piwik 0.9.9.8

    here is an example of old code:

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
    {$options}
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://webanalyse.rudolf-mueller.de/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', 8]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript';
        g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Piwik Code -->

    here is an example of new code:

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(["trackPageView"]);
      _paq.push(["enableLinkTracking"]);
    
      (function() {
        var u=(("https:" == document.location.protocol) ? "https" : "http") + "://webanalyse.rudolf-mueller.de/";
        _paq.push(["setTrackerUrl", u+"piwik.php"]);
        _paq.push(["setSiteId", "8"]);
        var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript";
        g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s);
      })();
    </script>
    <!-- End Piwik Code -->

    Thanks for your support

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

  2. braekling
    Member
    Plugin Author

    Posted 6 months ago #

    WP-Piwik fetches the tracking code from Piwik itself. After updating Piwik, WP-Piwik should get the new tracking code at least if you enter the WP-Piwik settings.

    If re-activating the "Insert tracking code" option does not help to get the new tracking code, please try to disable WP-Piwiks caching and retry - if this works, please tell me, because I was sure I fixed the caching issue.

    Which tracking code alternative did you select in WP-Piwik?

  3. PBoone
    Member
    Posted 6 months ago #

    Hey,
    thanks for your repley.

    I don't have the Caching turned on at all. Sorry :(

    But I am glad to hear that when it's working, then wp-piwik is supposed to get the tracking code from piwik.

    If it's any consalation, everything else with the plugin seems to be working fine.

    As an alternative, I placed the Tracking code I got from my Piwik site into the footer of my design template.

    Thanks for taking care of this, please inform me when the Problem is resolved, or if you Need more Information.

  4. braekling
    Member
    Plugin Author

    Posted 6 months ago #

    Did you try to reset WP-Piwik (support tab on settings page)? So WP-Piwik is forced to reload the tracking code.

  5. PBoone
    Member
    Posted 6 months ago #

    Hey,

    I just used the reset function and the code didn't change. I guess that means, that the PiWik API returns the wrong tracking code. So I guess I'll try to get it fixed over at Piwik... or maybe if you report it, then it will get a higher prcedence? What do you think?

    You know I compared the two code blocks and the only difference I can see ist the 4th line (including the comment) which has this on it:
    {$options}
    and thats it. If that line is removed then the old and new code blocks are identical.

  6. mhenschel
    Member
    Posted 6 months ago #

    Hi,
    I might have a similar problem. I got Piwik to work by disabling the automatic insertion of the tracking code from the plugin and inserting the code manually obtained from Piwik directly (through my theme functionality) into the footer.
    I also noticed, that the tracking code I see from this plugin is slightly different to the code I get directly from Piwik.

    Michael

  7. braekling
    Member
    Plugin Author

    Posted 6 months ago #

    The plugin also gets the tracking code directly from Piwik (using the API). But of course you can change it using the different settings of WP-Piwik. Did you try what I mentioned above?

    Did you try to reset WP-Piwik (support tab on settings page)? So WP-Piwik is forced to reload the tracking code.

  8. mhenschel
    Member
    Posted 6 months ago #

    I had a new install of Piwik with a new database.

  9. braekling
    Member
    Plugin Author

    Posted 6 months ago #

    I'm talking about the plugin, not Piwik itself.

    So did you try to reset WP-Piwik, so the plugin is forced to reload the tracking code?
    Can you tell me about your WP-Piwik configuration (REST or PHP API, tracking configuration)?

  10. mhenschel
    Member
    Posted 6 months ago #

    I didn't reset the plugin because I set up everything as a fresh install. In other words, I installed and activated the plugin, entered the piwik data, the tracking code was loaded and it didn't work. I'm using REST API. I then deactivated the plugin and copied the original piwik tracking code into my footer (through my theme's options) and everything worked fine.

Reply

You must log in to post.

About this Plugin

About this Topic