Can I filter Visitor Log by CustomVariable dynamically?

The use case is this… We have a customer who calls Customer Support and has some problem. We want the support person to see his browsing history and find out what he was doing on the site. His actions have already been recorded, and we have set up a CustomVariable with his ID. The way to view the browsing history now is to create a Segment report with this CustomVariable (value = userID), save it and then select it from the drop-down list. However, we do not really want a new segment - we only want to see the user’s history now and will not need it later. And we want the widget included as an iframe in our own admin pages.

Is there any way this can be done?

I ended up hitting the Live API with this URL:


$api_url = 'http://'.$config->ANALYTICS_URL.'/'.
	'?module=API&method=Live.getLastVisitsDetails'.
	'&idSite='.$config->ANALYTICS_SITE_ID.
	'&date=today&period=week'.
	'&segment=customVariableName1=@User;customVariableValue1=@-'.$customer_id.'-'.
	'&token_auth='.$config->ANALYTICS_USER_TOKEN.
	'&format=PHP';

I set the $customer_id as part of the value for customVariable 1
(note the “-” signs around $customer_id - I don’t want every record containing 10 when looking for customer with id=10)

I then un-serialize the data and display it in our interface.

However, this is still not real time - I get delayed data which is annoying. Is there a way to tell the API not to use the cache but get the raw data instead?

Live.getLastVisitsDetails does not use cache so it should return real time data. Can you try date=today&period=day instead?

Sorry, it turns out I have another problem instead :frowning:
It does return real-time values, it’s just that these values are not recorded for some reason and that’s why I don’t see them.

I do:

doTrackGoal
doTrackEcommerceCartUpdate
addEcommerceItem for each item
doTrackEcommerceOrder

and then only the goal shows in the log.

Piwik will track only one goal per second maximum, try remoe the trackGoal() (or record it one second later) and it may work?

It was a classic developer mistake… My code was all right, the data wasn’t. I had initialised my development DB but not the Piwik DB, so it was discarding checkouts because checkouts with these IDs existed already. Lost me all morning in trying to figure out what’s going on :frowning: