Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracker API setForceVisitDateTime should accept UNIX Timestamp as well as date time #2299

Closed
mattab opened this issue Apr 11, 2011 · 4 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Milestone

Comments

@mattab
Copy link
Member

mattab commented Apr 11, 2011

per title

@mattab
Copy link
Member Author

mattab commented Apr 11, 2011

(In [4411]) Fixes #2299, refs #2172 (in case it is easier for you, now the function will accept a timestamp as well)

@julienmoumne
Copy link
Member

On my box, PHP 5.3.5, Windows 7x64, http://dev.piwik.org/trac/browser/tags/1.5.2b4/core/Tracker/Visit.php#L66 returns true when an unix timestamp is provided.

is_int(123) = true
is_int("123") = false

The timestamp is therefore fed to strtotime which returns false.

The tracking output confirms the problem :

Current datetime: 1970-01-01 00:00:00

And the tracking process fails with the following error :

Error query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'visit_total_time' at row 1 In query: UPDATE piwik_log_visit SET visit_total_actions = visit_total_actions + 1, visit_exit_idaction_url = ?, visit_exit_idaction_name = ?, visit_last_action_time = ?, visit_total_time = ?, visit_goal_buyer = ? WHERE idsite = ? AND idvisit = ? Parameters: array ( 0 => 5, 1 => 1, 2 => '1970-01-01 00:00:00', 3 => -1302306504, 4 => '0', 5 => 1, 6 => '20', )

@mattab
Copy link
Member Author

mattab commented Sep 13, 2011

Also http://forum.piwik.org/read.php?2,80273



$t->setForceVisitDateTime(date("Y-m-d H:i:s", 1296546002))

This is being rendered as:

cdt=2011-02-01+07%3A40%3A02

rather than

cdt=2011-02-01%2007%3A40%3A02

I believe the setForceVisitDateTime() function is adding the +. 
  • must clarify API and provide better examples maybe?

@mattab
Copy link
Member Author

mattab commented Sep 28, 2011

(In [5254]) Fixes #2299

@mattab mattab added this to the 1.6 Piwik 1.6 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical.
Projects
None yet
Development

No branches or pull requests

2 participants