Using setCustomData() function to segment user types


I am trying to develop a function similar to GA’s custom variables function, where you can pass in a variable to determine whether the visitor is a registered member of our site or not. My initial thoughts are to use the setCustomData() function to pass Piwik the userID and then link the userID with the session cookie. (Of course we’ll have to create the link table between “piwik_log_visit” and our user table with “visitor_idcookie” as the primary keys.)

My 1st question is have anyone done something similar before? (As I think segmenting your site visitors by member/non-members is quiet common these days)

Also can someone point me in the right direction as to what do I have to do once I pass the information to the setCustomData() function? (which file to i have to modify/parse the string/find the cookie/match cookie with my member database/write to the link table) style_emoticons/<#EMO_DIR#>/huh.gif

Thanks so much!

FYI, I will be working on putting ‘Visitor custom variable’ in Piwik in the next release. Keep an eye on the ticket: Custom Variables support: new JS API and new reports · Issue #1984 · matomo-org/matomo · GitHub or the next release.