@zunaidk wrote:
Hi there
I am hoping someone can help me please.
I have a wordpress site where I want to track logged in users.
I'm attempting to do this via the UserID in Piwik and I've added the following into the tracking script (after the line that says: var _paq = _paq || []; )
_paq.push(['setUserId', '<?php global $piwikuserid;
if ( is_user_logged_in() ) {
$current_user = wp_get_current_user();
$piwikuserid = $current_user->user_login;
} else {
$piwikuserid = "visitor555";
}
echo $piwikuserid;
?>']);However, once I make the above change it doesn't track anything at all.
Can anyone please assist ? I am sure that the php code itself is correct.
Posts: 2
Participants: 1