@baris Thank you for the advice. I gave your suggestion a try and it does not seem to work. The app.user.uid is not being converted into the actual userid. When I look at the page source, after visiting the page, I see this:
As you can see app.user.uid was not replaced with my actual user id. Do you have another possible suggestion?
You can see its value by logging it to the browser console. For example
Strange, strange, strange. When I look at the browser console log I do see the "user id is 1' entry. (Yes, my user id on my forum is #1 -- my account was first.) But yet Piwik still does not see the number 1. If I put app.user.uid in single quotes then Piwik sees myself as user "app.user.uid". So, some thing is happening in the _paq.push(['setUserId', app.user.uid]); line such that even though the console is showing user 1 it is still not being parsed by Piwik.
This is what works:
Two single quotes and the plus symbol!
Geez, it feels like I just gave birth!
@rod It's nothing special, it's just a habit that I have trained myself into.
The reason I check for the existence of
app.useris because you cannot reference an object property (that is, the
uidproperty of the
ReferenceError: user is not defined).
If there's even a chance the parent object is not defined, I make a check for it first (though
appis always defined in NodeBB, so I skip that).
The proper way to write it would be:
if (app.hasOwnProperty('user')), but even sometimes that can be tripped up if
app.useris a property, but