Visitor Generator script executing but not generating any data!


(Kiran) #1

Hi,

I just installed piwik today and trying to generate some data but that does not seem to work.

The script localhost/piwik/misc/generateVisits runs ok and I get the following page :

Generated 79 unique visitors and 5 actions per visit for the 2010-03-26

Total actions: 416
Total requests per sec: 330
Time elapsed: 1.261s


But when I look at mySQL database, no records have been added to the database, therefore the dashboard is also not showing anything. I have also looked at the Apache log files to see if there is any error but there is none style_emoticons/<#EMO_DIR#>/unsure.gif

The site I am trying to track is also on the localhost.

Would really appreciate it if someone could point me to the right direction. I have pretty much re-installed piwik and deleted the old database and started everything from scratch but no good style_emoticons/<#EMO_DIR#>/sad.gif

Thanks in advance.

Kiran


(Matthieu Aubry) #2

are you looking at the right DB? check the credentials in your config/config.ini.php

if the visit generator works, data is most likely inserted in your db


(Kiran) #3

[quote=matthieu @ Mar 26 2010, 06:25 PM]are you looking at the right DB? check the credentials in your config/config.ini.php

if the visit generator works, data is most likely inserted in your db[/quote]

Hi,

Thanks a lot for replying.

Yes I am looking at the right database. That is what I find so confusing as the visit generator is working fine but it doesn’t insert anything into the database. style_emoticons/<#EMO_DIR#>/blink.gif

I shall try again on Monday as it’s on my work PC and provide an update.

Thanks once again.

Kiran


(Kiran) #4

Just checked the config.ini.php file and it is pointing to the right database.

When I installed piwik, it did create the the database on localhost successfully, the only problem is that it doesnt seem to insert any data when running the script though style_emoticons/<#EMO_DIR#>/sad.gif

Is there any other configuration file where the value of the database needs to be written?


(vipsoft) #5

By default, the visit generator adds the data to idsite=1. If you’ve been adding/deleting sites, then idsite=1 may no longer be visible to you. In which case, the simple fix is to edit $idSite in misc/generateVisits.php.


(Kiran) #6

Thanks for your reply.

I have only added one site to it and checked the siteID as I thought that could be one of the reasons why the data is not being inserted. It is set to 1.

I think the problem is with the generateVisits.php code. Reason being that when I do open up the pages that have the piwik tracking javascript inserted in it, it does log the visits to the database.

Thanks,
Kiran


(vipsoft) #7

You might have to set your PHP timezone and drop the existing archive tables so that these are regenerated.


(Kiran) #8

Hi vip,

Thanks. Complete stupid question as I am utter newbie to PHP as well style_emoticons/<#EMO_DIR#>/blink.gif : how do I set the PHP timezone?

As for dropping the tables, I am assuming just delete those two tables from the database right?

Thanks,
Kiran


(marten_cz) #9

Hi Kiran,

I had the same problem. My problem was that the site is in excluded list? Or something like that. Go to core/Tracker/visit.php on line 91 is if($this->isExcluded()). Comment out whole if condition.


(Kiran) #10

[quote=marten_cz @ Mar 31 2010, 09:26 AM]Hi Kiran,

I had the same problem. My problem was that the site is in excluded list? Or something like that. Go to core/Tracker/visit.php on line 91 is if($this->isExcluded()). Comment out whole if condition.[/quote]

Hi Marten.

Thanks a lot for replying Marten. You are right. The problem is with the isExcluded method in the Piwik_Tracker_Visit class (/core/Tracker/Visit.php). My boss has fixed the bug as commenting it would cause other problems style_emoticons/<#EMO_DIR#>/blink.gif

Right, here is what needs to be done to fix this bug in the new version of Piwik.

SOLUTION

So the problem was in the isExcluded method in the Piwik_Tracker_Visit class (/core/Tracker/Visit.php). It checks whether the parameter “rec” is set.

$toRecord = Piwik_Common::getRequestVar(‘rec’, false, ‘int’);

Easy fix is in Piwik_Tracker_Generator class (/core/Tracker/Generator.php) in method: setFakeRequest

You have to add the line: $_GET[“rec”] = 1;

Then it’s working… style_emoticons/<#EMO_DIR#>/laugh.gif

Full method looks like this:

        protected function setFakeRequest()
        {
                $_GET = $this->currentget;
                $_GET["rec"] = 1;
        }

(Matthieu Aubry) #11

Oh! good one. we added the rec=1 parameter in 0.5.5 and forgot to update the visit generator. I fixed it in trunk: http://dev.piwik.org/trac/changeset/2026