• Resolved friendlyfire

    (@friendlyfire)


    First, love the automated way you give network admins the ability to create new analytic properties via this plugin. Really cool stuff!
    Question:
    Will you ever offer support for user tracking?

    From this thread https://forum.piwik.org/t/show-wordpress-user-name/8637/23
    I noticed that you can use this in the script:

    <!-- Function to get the username from WordPress for Piwik User Tracking -->
    <?php
    global $current_user;
    get_currentuserinfo();
    $user_info = get_userdata(1);
    $Username =  $current_user->user_login;?>
    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
    <!-- Piwik Custom Variable for User Tracking -->
    _paq.push(['setCustomVariable',1,"Username", "<?php if (empty($Username)) {echo 'Guest';} else {echo $Username;}?>","visit"]);
    <!-- End Piwik Custom Variable for User Tracking -->
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//agency.atlas6.koding.io/analytics/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', 1]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>

    It doesn’t work when I edit the code in the plugin’s enable tracking/manually tab. something happens where the ‘->’ shows everything after it on the page (user_login?>).

    So I have to copy the code and put it my footer.php file. This works but renders your great plugin’s automation useless.

    Support for setting up user tracking from the settings (and doing it across all subsites) would be fantastic.

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

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

    (@braekling)

    It is not possible use this script as “manual entered tracking code”, because it contains PHP which won’t be executed.

    I will put this on the list of feature requests… I shouldn’t be too complex, so maybe I can deliver this with the next release end of February.

    Daniel Wilson

    (@danw310895)

    @friendlyfire We too were looking for User ID tracking within WP-Piwik

    @braekling – I’ve opened PR #16 on GitHub to implement this – all tested and working at my end! ??

    On the last day of February too, ready for end of Feb release ??

    Cheers!
    – @Danw33

    Plugin Author braekling

    (@braekling)

    Thanks a lot! I will have a look at this and create a new release asap.

    Plugin Author braekling

    (@braekling)

    1.0.7 release will be available soon. Thx, Daniel!

    Thread Starter friendlyfire

    (@friendlyfire)

    Since I have some custom code that needs to go in each footer, will this release allow me to put it in along side the rest of the code that your plugin generates? For example, I need to add a few things to this script:

    Or what’s the best way to do that without doing it for every site on the network individually?

    <!-- Piwik -->
    <script type="text/javascript">
      var _paq = _paq || [];
      _paq.push(['trackPageView']);
      _paq.push(['enableLinkTracking']);
      (function() {
        var u="//agency.atlas6.koding.io/analytics/";
        _paq.push(['setTrackerUrl', u+'piwik.php']);
        _paq.push(['setSiteId', 1]);
        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
      })();
    </script>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘support for user tracking?’ is closed to new replies.