Trying to get Joomla user in Piwik

Hi all

I’m using Joomla here, and have been using Piwik for a long time, it looks really great.
I would like to track the username as well, and I found another (old) article on this page, about how to do that.
I inserted this:

$user =& JFactory::getUser();
$uname=$user->name;

In the index.php for the template.
Then I used the wizard to create the tracking code and that inserted

_paq.push(["setCustomVariable", 1, "User", "<?php echo $uname; ?>", "visit"]);

In the code, but in the backend it just shows:
User <?php echo $uname; ?>
Instead of the User username