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

doTrackGoal() in the PHP API should return success or failure response, not tracking GIF #12739

Closed
olleharstedt opened this issue Apr 18, 2018 · 5 comments · Fixed by #15551 · May be fixed by DevVault/matomo#1
Closed

doTrackGoal() in the PHP API should return success or failure response, not tracking GIF #12739

olleharstedt opened this issue Apr 18, 2018 · 5 comments · Fixed by #15551 · May be fixed by DevVault/matomo#1
Assignees
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently.
Milestone

Comments

@olleharstedt
Copy link

As title. It's unsure from the result from doTrackGoal() if the tracking succeeded or failed. A better response than a tracking GIF or empty string would be to prefer.

@kylekatarnls
Copy link
Contributor

I had to add debug var_dump to get curl error and fix it.

If you get empty string and no goal tracked in your analytics, you can try to debug it by doing this:

Modify the doTrackGoal method after the curl_exec call: var_dump(curl_error($ch)); to dump the cURL error.

Hope it could help.

@olleharstedt
Copy link
Author

Tracking works for us, but if it suddenly stopped working we need to be able to see this. Checking for GIF or empty result is not a convincing way to do this.

@mattab mattab added this to the 4.0.0 milestone Jun 18, 2019
@tsteur
Copy link
Member

tsteur commented Dec 16, 2019

@olleharstedt @kylekatarnls
Not sure when tracking a goal would fail? You mean if you set an idGoal and the idGoal did not exist?

We could possibly return an HTTP 400 here https://github.com/matomo-org/matomo/blob/3.13.0/plugins/Goals/Tracker/GoalsRequestProcessor.php#L87-L92

Throwing an invalid param exception should do the trick

@olleharstedt
Copy link
Author

400 is one way, returning JSON with error message and error code another.

@tsteur tsteur self-assigned this Feb 11, 2020
@tsteur tsteur added the c: Usability For issues that let users achieve a defined goal more effectively or efficiently. label Feb 11, 2020
@olleharstedt
Copy link
Author

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: Usability For issues that let users achieve a defined goal more effectively or efficiently.
Projects
None yet
4 participants