Quantcast
Viewing all articles
Browse latest Browse all 4243

How to capture username as custom variable or otherwise? (no replies)

I'm not a developer, but I've been trying to get a snippet together that I can use to track usernames on my LMS site running Blackboard Learn. Piwik works perfectly to consolidate all the data that was previously being thrown away. However, I'd like to report, not on IP addresses, but on actual usernames. I've read the documents regarding custom variables and JS as provided in other forum posts, but it (so far) doesn't make much sense to me. Here is a "scrubbed" snippet that I'm using w/o success. I put this together based on other documents and posts:

<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['setCustomVariable',1,"Username", "<?php if (empty($Username)) {echo 'Guest';} else {echo $Username ;}?>","visit"]);
<?php
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//myserver.mydomain.com/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', 6]);
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>
<noscript><p><img src="//myserver.mydomain.com/piwik.php?idsite=6" style="border:0;" alt="" /></p></nosc ript>
<!-- End Piwik Code -->

Thanks.

Viewing all articles
Browse latest Browse all 4243

Trending Articles