Force Visit Date and IP


#1

We are trying to use Piwik to display usage stats for mobiles apps we’ve developed. We are storing page views in a proprietary database and was hoping to use the Tracker API to get the statistics into Piwik.

By default, it seems like the date/time and IP address are taken from the API request. But it appears that the Piwik_Tracker class does have methods to force the date and time and IP address. I am doing something similar to the proxy here:

http://dev.piwik.org/trac/browser/trunk/tests/integration/proxy-piwik.php

This is the proxy we are trying to use so we can force the date/time and IP.


<?php
	include_once 'core/Common.php';
	include_once 'core/Tracker.php';
		
	// Custom IP to use for this visitor
	$customIp = Piwik_Common::getRequestVar('cip', false);
	if(!empty($customIp))
	{
	    Piwik_Tracker::setForceIp($customIp);
	}
	
	// Custom server date time to use
	$customDatetime = Piwik_Common::getRequestVar('cdt', false);
	if(!empty($customDatetime))
	{
	    Piwik_Tracker::setForceDateTime($customDatetime);
	}
	
	include 'piwik.php';
	
?>

This proxy to set the date/time and IP address does not seem to be working fully. The odd thing is that I can see the hits show up in the “Real Visitors Log” widget. But the hits are not shown in any other Visit graph widgets.

I would appreciate any help on getting Piwik to log our historic data.

Thanks!
Jeff


(Matthieu Aubry) #2

I guess that maybe the problem is with ts_created field in the website table. By default, data will show only for dates after the website creation date. please update these dates manually.


#3

I tried running some tests with the forced date having a date that is later than the ts_created field. Still no luck. I can see my hits in the “Real Time Visitors” widget. But for some reason, I cannot get the “Last Visits Graph” to show these hits.

Any other ideas?


(Matthieu Aubry) #4

Setting IP and date will be available in 1.2

Also, you must delete archive tables to re-process the logs


#5

Dropping the tables worked. Thanks!

How soon will 1.2 be available?