[ASSISTANCE] Piwik Showing Logged in Members (Forum) Info


#1

Hi all,

I am hoping somebody can help me revise my piwik code so that it shows our forum members display name as Clicky currently does in place of the IP showing for the visitor ID? The code I use for Clicky to do this is shown below (site I.D. XXXX’d out):


<!-- START CODE - Clicky -->
<script type="text/javascript">
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(xxxxxxxx);
(function() {
  var s = document.createElement('script');
  s.type = 'text/javascript';
  s.async = true;
  s.src = '//static.getclicky.com/js';
  ( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
})();
  var clicky_custom = {};
  clicky_custom.session = {
    username: "{$this->memberData['members_display_name']}",
    group: "User"
  };
</script>
<!-- END CODE - Clicky -->

I am using this code for Piwik:


<!-- Piwik -->
<script type="text/javascript">
var pkBaseURL = (("https:" == document.location.protocol) ? "https://domain.com/piwik/" : "http://domain.com/piwik/");
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
</script><script type="text/javascript">
try {
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 1);
piwikTracker.trackPageView();
piwikTracker.enableLinkTracking();
} catch( err ) {}
</script><noscript><p><img src="http://domain.com/piwik/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
<!-- End Piwik Tracking Code -->

If any one could adjust the Piwik code to include the relevant changes I would be most appreciative!

Many thanks in advance for your help with this :slight_smile:

Andy


(Matthieu Aubry) #2

see Custom Variables Analytics - Analytics Platform - Matomo


#3

Hi Matt,

I of course read through all of the info regarding custom variables before posting. I posted as after reading it I didn’t know what to adjust in the code to get the results I am looking for hence my post hoping one of the community that is more technically minded than me (not difficult) would be kind enough to help :slight_smile:

If any one could adjust the Piwik code to include the relevant changes I would be most appreciative!

Many thanks in advance for your help with this smiling :slight_smile:

Andy


(Matthieu Aubry) #4

piwikTracker.setCustomVariable(1, "username", "{$this->memberData['members_display_name']}" );
// this is before the call to trackPageView()


#5

Awesome thanks Matt.

What I am trying to do is have the Member name (forum user) showing on the latest visitor info for example in place of the IP address or next to it.


(Matthieu Aubry) #6

Custom variables will show up in the Visitors> visitor log


#7

Hi,

Okay so noway to actually have it shown in real time visitor info too then if I understand this correctly?

Thanks for helping :slight_smile:

Andy


#8

Unable to post the code as it puts smilies in place of ) so attached an image.

Am I correct with my assumption in my last post in this thread?


#9

[quote=Azounstone]
Hi,

Okay so noway to actually have it shown in real time visitor info too then if I understand this correctly?

Thanks for helping :slight_smile:

Andy[/quote]
Confirmation on this would be much appreciated :slight_smile: