Title: support for user tracking?
Last modified: August 31, 2016

---

# support for user tracking?

 *  Resolved [friendlyfire](https://wordpress.org/support/users/friendlyfire/)
 * (@friendlyfire)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/support-for-user-tracking/)
 * 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 [http://forum.piwik.org/t/show-wordpress-user-name/8637/23](http://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://wordpress.org/plugins/wp-piwik/](https://wordpress.org/plugins/wp-piwik/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/support-for-user-tracking/#post-7060745)
 * 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](https://wordpress.org/support/users/danw310895/)
 * (@danw310895)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/support-for-user-tracking/#post-7060840)
 * [@friendlyfire](https://wordpress.org/support/users/friendlyfire/) We too were
   looking for User ID tracking within WP-Piwik
 * [@braekling](https://wordpress.org/support/users/braekling/) – I’ve opened [PR #16](https://github.com/braekling/WP-Piwik/pull/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](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/support-for-user-tracking/#post-7060847)
 * Thanks a lot! I will have a look at this and create a new release asap.
 *  Plugin Author [braekling](https://wordpress.org/support/users/braekling/)
 * (@braekling)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/support-for-user-tracking/#post-7060848)
 * 1.0.7 release will be available soon. Thx, Daniel!
 *  Thread Starter [friendlyfire](https://wordpress.org/support/users/friendlyfire/)
 * (@friendlyfire)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/support-for-user-tracking/#post-7060851)
 * 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.

 * ![](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/)

## Tags

 * [piwik](https://wordpress.org/support/topic-tag/piwik/)

 * 5 replies
 * 3 participants
 * Last reply from: [friendlyfire](https://wordpress.org/support/users/friendlyfire/)
 * Last activity: [10 years, 5 months ago](https://wordpress.org/support/topic/support-for-user-tracking/#post-7060851)
 * Status: resolved